Package com.semedy.reasoner.api.builtin
Class SimilarityBuiltin
java.lang.Object
com.semedy.reasoner.api.builtin.SimilarityBuiltin
- All Implemented Interfaces:
Builtin
,FunctionalBuiltin
- Direct Known Subclasses:
Cosine2
,Cosine3
,Damerau
,FuzzySearch
,Hamming
,Jaccard
,JaroWinkler
,Letters
,Levenshtein
,LongestCommonSubsequence
,NGram3
,NGram4
,Optimal
,QGram3
,QGram4
,Sorensondice
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
frees up allocated resourcesclone the builtinboolean
Given the input tuple and the instantiated arguments.void
call back function.String[]
get descriptions for the different argumentsint
getArity()
get the arity of the builtinget a description for the builtinfloat
float
getName()
get the name of the builtingetType()
get the type of the builtinlong
the weight of the builtin.void
initialize the builtinboolean
isEvaluable
(BitSet args, BitSet arg1, Object[] arg2) is builtin evaluable with a certain instantiation of variablesboolean
is it a builtin for internal use onlyobjectGeneratingArguments
(BitSet arg0, BitSet arg1, Object[] arg2) In which argument position are new objects createdboolean
does the builtin read the symbol tablevoid
setProperties
(Properties arg0) set the sytem propertiesvoid
setSymbolTable
(SymbolTable symbols) set the symbol tabledouble
similarity
(String s1, String s2) boolean
does the builtin write into the symbol table
-
Constructor Details
-
SimilarityBuiltin
public SimilarityBuiltin()
-
-
Method Details
-
evaluate
public boolean evaluate(long[] input, BitSet grounds) throws InterruptedException, IOException, SemReasonerException Description copied from interface:FunctionalBuiltin
Given the input tuple and the instantiated arguments. The evaluation substitutes variables of the input tuple by concrete values- Specified by:
evaluate
in interfaceFunctionalBuiltin
- Parameters:
input
- , the codes of the input valuesgrounds
- , which input arguments are ground- Returns:
- Throws:
InterruptedException
IOException
SemReasonerException
-
similarity
-
clear
public void clear()Description copied from interface:Builtin
frees up allocated resources -
cloneBuiltin
Description copied from interface:Builtin
clone the builtin- Specified by:
cloneBuiltin
in interfaceBuiltin
- Returns:
- the cloned built-in
-
evaluationFinished
Description copied from interface:Builtin
call back function. Is called when the whole evaluation has been finished- Specified by:
evaluationFinished
in interfaceBuiltin
- Throws:
BuiltinException
InterruptedException
-
getArgumentDescriptions
Description copied from interface:Builtin
get descriptions for the different arguments- Specified by:
getArgumentDescriptions
in interfaceBuiltin
- Returns:
- a description of the arguments of the built-in
-
getArity
public int getArity()Description copied from interface:Builtin
get the arity of the builtin -
getDescription
Description copied from interface:Builtin
get a description for the builtin- Specified by:
getDescription
in interfaceBuiltin
- Returns:
- a description of the built-in
-
getName
Description copied from interface:Builtin
get the name of the builtin -
getType
Description copied from interface:Builtin
get the type of the builtin -
getWeight
Description copied from interface:Builtin
the weight of the builtin. Determines when the builtin is executed in a rule -
init
Description copied from interface:Builtin
initialize the builtin- Specified by:
init
in interfaceBuiltin
- Parameters:
arg0
- , the builtin arguments- Throws:
InterruptedException
IOException
SemReasonerException
-
isEvaluable
Description copied from interface:Builtin
is builtin evaluable with a certain instantiation of variables- Specified by:
isEvaluable
in interfaceBuiltin
- Parameters:
args
- , which arguments are groundarg1
- , which variables are instantiatedarg2
- , the arguments- Returns:
- was it evaluable
- Throws:
BuiltinException
-
isInternal
public boolean isInternal()Description copied from interface:Builtin
is it a builtin for internal use only- Specified by:
isInternal
in interfaceBuiltin
- Returns:
-
objectGeneratingArguments
public BitSet objectGeneratingArguments(BitSet arg0, BitSet arg1, Object[] arg2) throws BuiltinException Description copied from interface:Builtin
In which argument position are new objects created- Specified by:
objectGeneratingArguments
in interfaceBuiltin
- Parameters:
arg0
- , ground argument positionsarg1
- , instantiated variablesarg2
- , arguments of the literal- Returns:
- each bit indicates the argument position where new objects are created
- Throws:
BuiltinException
-
readsSymbolTable
public boolean readsSymbolTable()Description copied from interface:Builtin
does the builtin read the symbol table- Specified by:
readsSymbolTable
in interfaceBuiltin
- Returns:
- true if it reads the symbol table
-
setProperties
Description copied from interface:Builtin
set the sytem properties- Specified by:
setProperties
in interfaceBuiltin
- Parameters:
arg0
- , properties
-
setSymbolTable
Description copied from interface:Builtin
set the symbol table- Specified by:
setSymbolTable
in interfaceBuiltin
- Parameters:
symbols
- , the symbol table
-
writesSymbolTable
public boolean writesSymbolTable()Description copied from interface:Builtin
does the builtin write into the symbol table- Specified by:
writesSymbolTable
in interfaceBuiltin
- Returns:
- true if it writes to the symbol table
-
getMinLevel
public float getMinLevel() -
getMaxLevel
public float getMaxLevel()
-