Class CognateQlt
- java.lang.Object
-
- com.tibco.patterns.learn.api.feature.AbstractQlt<T>
-
- com.tibco.patterns.learn.api.feature.TextQlt<com.tibco.patterns.learn.jaxb.model.CognateQueryType>
-
- com.tibco.patterns.learn.api.feature.CognateQlt
-
-
Constructor Summary
Constructors Constructor Description CognateQlt(int[] fieldIndexes, double[] fieldWeights, double nonCogWeight, java.util.List<java.lang.String> allFields)Creates cognate querylet with given parameters.CognateQlt(int[] fieldIndexes, double nonCogWeight, java.util.List<java.lang.String> allFields)Default field weights 1.0 are used.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringasJavaCode(java.lang.String qltVarName, java.lang.String valuesVarName, java.lang.String fieldNamesVarName)Converts the querylet to a Java code string.java.lang.DoublegetEmptyFieldPenalty()Gets the empty field penalty.java.util.List<java.lang.String>getFieldNames()doublegetFieldWeight(int fieldIndex)com.netrics.likeit.NetricsQuerygetNetricsQlt(java.lang.String[] values)Constructs a NetricsQuery querylet from the stored XML structure and the given field values.doublegetNonCognateWeight()Gets non-cognate weight applied when a value is entered in a wrong field.java.lang.StringgetThesaurusName()doublegetThesaurusWeight()booleanhasThesaurus()java.lang.BooleanisMatchEmpty()voidsetEmptyFieldPenalty(double penalty)Sets empty field penalty.voidsetFields(int[] fieldIndexes, double[] fieldWeights)Replaces the list of fields in the querylet.voidsetFieldWeight(int fieldIndex, double weight)Sets the weight of the given field.voidsetMatchEmpty(boolean value)Sets the Match Empty parameter.voidsetNonCognateWeight(double weight)Sets non-cognate weight applied when a value is entered in a wrong field.-
Methods inherited from class com.tibco.patterns.learn.api.feature.TextQlt
serverThesName
-
Methods inherited from class com.tibco.patterns.learn.api.feature.AbstractQlt
getDftFieldWeight, getFieldIndex, getNFields, toString
-
-
-
-
Constructor Detail
-
CognateQlt
public CognateQlt(int[] fieldIndexes, double[] fieldWeights, double nonCogWeight, java.util.List<java.lang.String> allFields)Creates cognate querylet with given parameters.- Parameters:
fieldIndexes- must contain only indexes from the list of all fields (which was passed to the constructor). A fieldIndex parameter in other methods refers to the number and order of the fields given here in fieldIndexes.fieldWeights- - the weights for each field in the querylet. May be null to set default weight 1.0.nonCogWeight- - non-cognate weight applied when a value is entered in a wrong field.allFields- - all non-key fields in the data table.- Throws:
java.lang.IllegalArgumentException- if 2 or more field indexes are not provided, or if an incorrect number of field weights is provided, or a weight value is invalid, or if no fields are specified in allFields.
-
CognateQlt
public CognateQlt(int[] fieldIndexes, double nonCogWeight, java.util.List<java.lang.String> allFields)Default field weights 1.0 are used.
-
-
Method Detail
-
setFields
public void setFields(int[] fieldIndexes, double[] fieldWeights)Replaces the list of fields in the querylet.- Specified by:
setFieldsin classTextQlt<com.tibco.patterns.learn.jaxb.model.CognateQueryType>- Parameters:
fieldIndexes- must contain only indexes from the list of all fields (which was passed to the constructor). A fieldIndex parameter in other methods refers to the number and order of the fields given here in fieldIndexes.fieldWeights- - the weights for each field in the querylet. May be null to set default weight 1.0.- Throws:
java.lang.IllegalArgumentException- if 2 or more field indexes are not provided, or if an incorrect number of field weights is provided, or a weight value is invalid.
-
getNetricsQlt
public com.netrics.likeit.NetricsQuery getNetricsQlt(java.lang.String[] values)
Description copied from interface:QueryletConstructs a NetricsQuery querylet from the stored XML structure and the given field values. The NetricsQuery can then be used to obtain a feature score from the Patterns server. The querylet must use symmetric score type (if it is supported by the NetricsQuery type that it constructs).- Parameters:
values- - The values of all non-key fields in the record. The index of the field value to be used is determined by the field name that is read from the list of all fields stored in XML querylet structure.- Returns:
- the constructed NetricsQuery querylet.
- Throws:
java.lang.IllegalArgumentException- if incorrect number of table field values is provided.
-
getFieldNames
public java.util.List<java.lang.String> getFieldNames()
- Returns:
- a list with names of all fields used in the querylet.
-
asJavaCode
public java.lang.String asJavaCode(java.lang.String qltVarName, java.lang.String valuesVarName, java.lang.String fieldNamesVarName)Description copied from interface:QueryletConverts the querylet to a Java code string. Parameters are variable names in Java code. The new querylet must be assigned to qltVarName, then additional Java statements can be added to configure the querylet. The generated querylet must use symmetric score type (if it is supported by the NetricsQuery type that it constructs).- Parameters:
qltVarName- - the name of the variable to which the querylet is assigned.valuesVarName- - name of variable of type String[] that stores field values.fieldNamesVarName- - name of variable of type List<String> that stores all field names in the data table.- Returns:
- a string with Java code that creates the given querylet.
-
setFieldWeight
public void setFieldWeight(int fieldIndex, double weight)Description copied from class:TextQltSets the weight of the given field.- Specified by:
setFieldWeightin classTextQlt<com.tibco.patterns.learn.jaxb.model.CognateQueryType>- Parameters:
fieldIndex- - index of the field in the list of fields assigned to this querylet.weight- - the new field weight.
-
getFieldWeight
public double getFieldWeight(int fieldIndex)
- Specified by:
getFieldWeightin classTextQlt<com.tibco.patterns.learn.jaxb.model.CognateQueryType>- Parameters:
fieldIndex- - index of the field in the list of fields assigned to this querylet.- Returns:
- the weight of the given field.
-
setMatchEmpty
public void setMatchEmpty(boolean value)
Description copied from class:TextQltSets the Match Empty parameter. If this is true, matching two empty strings results in an exact match score. If false (default), this results in an empty score.- Specified by:
setMatchEmptyin classTextQlt<com.tibco.patterns.learn.jaxb.model.CognateQueryType>- Parameters:
value- - the value of the Match Empty parameter.
-
isMatchEmpty
public java.lang.Boolean isMatchEmpty()
- Specified by:
isMatchEmptyin classTextQlt<com.tibco.patterns.learn.jaxb.model.CognateQueryType>- Returns:
- the Match Empty parameter, or null if it was not set and the default is used.
- See Also:
TextQlt.setMatchEmpty(boolean)
-
setNonCognateWeight
public void setNonCognateWeight(double weight)
Sets non-cognate weight applied when a value is entered in a wrong field.
-
getNonCognateWeight
public double getNonCognateWeight()
Gets non-cognate weight applied when a value is entered in a wrong field.
-
setEmptyFieldPenalty
public void setEmptyFieldPenalty(double penalty)
Sets empty field penalty. It is applied to unmatched data that could be attributed to an empty field. A default penalty of 1.0 means the match score is fully penalized for the unmatched data. A penalty of 0.0 means the unmatched data is ignored.
-
getEmptyFieldPenalty
public java.lang.Double getEmptyFieldPenalty()
Gets the empty field penalty. SeesetEmptyFieldPenalty(double).- Returns:
- the empty field penalty, or null if the default penalty is used.
-
hasThesaurus
public boolean hasThesaurus()
- Specified by:
hasThesaurusin classTextQlt<com.tibco.patterns.learn.jaxb.model.CognateQueryType>- Returns:
- true if thesaurus has been assigned to this querylet.
-
getThesaurusName
public java.lang.String getThesaurusName()
- Specified by:
getThesaurusNamein classTextQlt<com.tibco.patterns.learn.jaxb.model.CognateQueryType>- Returns:
- thesaurus name, or null if thesaurus is not assigned
-
getThesaurusWeight
public double getThesaurusWeight()
- Specified by:
getThesaurusWeightin classTextQlt<com.tibco.patterns.learn.jaxb.model.CognateQueryType>- Returns:
- thesaurus weight, or default weight if thesaurus is not assigned. getThesaurusName() should be used first to check if the thesaurus is assigned.
-
-