
org.dmg.pmml.TextIndex Maven / Gradle / Ivy
package org.dmg.pmml;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElements;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.dmg.pmml.adapters.FieldNameAdapter;
import org.jpmml.schema.Added;
import org.jpmml.schema.Version;
/**
* Java class for anonymous complex type.
*
*
The following schema fragment specifies the expected content contained within this class.
*
*
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{http://www.dmg.org/PMML-4_3}Extension" maxOccurs="unbounded" minOccurs="0"/>
* <element ref="{http://www.dmg.org/PMML-4_3}TextIndexNormalization" maxOccurs="unbounded" minOccurs="0"/>
* <group ref="{http://www.dmg.org/PMML-4_3}EXPRESSION"/>
* </sequence>
* <attribute name="textField" use="required" type="{http://www.dmg.org/PMML-4_3}FIELD-NAME" />
* <attribute name="localTermWeights" default="termFrequency">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <enumeration value="termFrequency"/>
* <enumeration value="binary"/>
* <enumeration value="logarithmic"/>
* <enumeration value="augmentedNormalizedTermFrequency"/>
* </restriction>
* </simpleType>
* </attribute>
* <attribute name="isCaseSensitive" type="{http://www.w3.org/2001/XMLSchema}boolean" default="false" />
* <attribute name="maxLevenshteinDistance" type="{http://www.dmg.org/PMML-4_3}INT-NUMBER" default="0" />
* <attribute name="countHits" default="allHits">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <enumeration value="allHits"/>
* <enumeration value="bestHits"/>
* </restriction>
* </simpleType>
* </attribute>
* <attribute name="wordSeparatorCharacterRE" type="{http://www.w3.org/2001/XMLSchema}string" default="\s" />
* <attribute name="tokenize" type="{http://www.w3.org/2001/XMLSchema}boolean" default="true" />
* </restriction>
* </complexContent>
* </complexType>
*
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"extensions",
"textIndexNormalizations",
"expression"
})
@XmlRootElement(name = "TextIndex", namespace = "http://www.dmg.org/PMML-4_3")
@Added(Version.PMML_4_2)
public class TextIndex
extends org.dmg.pmml.Expression
implements HasExpression, HasExtensions
{
@XmlAttribute(name = "textField", required = true)
@XmlJavaTypeAdapter(FieldNameAdapter.class)
private FieldName textField;
@XmlAttribute(name = "localTermWeights")
private TextIndex.LocalTermWeights localTermWeights;
@XmlAttribute(name = "isCaseSensitive")
private Boolean isCaseSensitive;
@XmlAttribute(name = "maxLevenshteinDistance")
private Integer maxLevenshteinDistance;
@XmlAttribute(name = "countHits")
private TextIndex.CountHits countHits;
@XmlAttribute(name = "wordSeparatorCharacterRE")
private String wordSeparatorCharacterRE;
@XmlAttribute(name = "tokenize")
private Boolean tokenize;
@XmlElement(name = "Extension", namespace = "http://www.dmg.org/PMML-4_3")
private List extensions;
@XmlElement(name = "TextIndexNormalization", namespace = "http://www.dmg.org/PMML-4_3")
private List textIndexNormalizations;
@XmlElements({
@XmlElement(name = "Constant", namespace = "http://www.dmg.org/PMML-4_3", type = Constant.class),
@XmlElement(name = "FieldRef", namespace = "http://www.dmg.org/PMML-4_3", type = FieldRef.class),
@XmlElement(name = "NormContinuous", namespace = "http://www.dmg.org/PMML-4_3", type = NormContinuous.class),
@XmlElement(name = "NormDiscrete", namespace = "http://www.dmg.org/PMML-4_3", type = NormDiscrete.class),
@XmlElement(name = "Discretize", namespace = "http://www.dmg.org/PMML-4_3", type = Discretize.class),
@XmlElement(name = "MapValues", namespace = "http://www.dmg.org/PMML-4_3", type = MapValues.class),
@XmlElement(name = "TextIndex", namespace = "http://www.dmg.org/PMML-4_3", type = TextIndex.class),
@XmlElement(name = "Apply", namespace = "http://www.dmg.org/PMML-4_3", type = Apply.class),
@XmlElement(name = "Aggregate", namespace = "http://www.dmg.org/PMML-4_3", type = Aggregate.class),
@XmlElement(name = "Lag", namespace = "http://www.dmg.org/PMML-4_3", type = Lag.class)
})
private org.dmg.pmml.Expression expression;
private final static Boolean DEFAULT_IS_CASE_SENSITIVE = false;
private final static Integer DEFAULT_MAX_LEVENSHTEIN_DISTANCE = 0;
private final static Boolean DEFAULT_TOKENIZE = true;
public TextIndex() {
super();
}
public TextIndex(final FieldName textField) {
super();
this.textField = textField;
}
/**
* Gets the value of the textField property.
*
* @return
* possible object is
* {@link String }
*
*/
public FieldName getTextField() {
return textField;
}
/**
* Sets the value of the textField property.
*
* @param textField
* allowed object is
* {@link String }
*
*/
public TextIndex setTextField(FieldName textField) {
this.textField = textField;
return this;
}
/**
* Gets the value of the localTermWeights property.
*
* @return
* possible object is
* {@link TextIndex.LocalTermWeights }
*
*/
public TextIndex.LocalTermWeights getLocalTermWeights() {
if (localTermWeights == null) {
return TextIndex.LocalTermWeights.TERM_FREQUENCY;
} else {
return localTermWeights;
}
}
/**
* Sets the value of the localTermWeights property.
*
* @param localTermWeights
* allowed object is
* {@link TextIndex.LocalTermWeights }
*
*/
public TextIndex setLocalTermWeights(TextIndex.LocalTermWeights localTermWeights) {
this.localTermWeights = localTermWeights;
return this;
}
/**
* Gets the value of the isCaseSensitive property.
*
* @return
* possible object is
* {@link Boolean }
*
*/
public boolean isIsCaseSensitive() {
if (isCaseSensitive == null) {
return DEFAULT_IS_CASE_SENSITIVE;
} else {
return isCaseSensitive;
}
}
/**
* Sets the value of the isCaseSensitive property.
*
* @param isCaseSensitive
* allowed object is
* {@link Boolean }
*
*/
public TextIndex setIsCaseSensitive(Boolean isCaseSensitive) {
this.isCaseSensitive = isCaseSensitive;
return this;
}
/**
* Gets the value of the maxLevenshteinDistance property.
*
* @return
* possible object is
* {@link Integer }
*
*/
public Integer getMaxLevenshteinDistance() {
if (maxLevenshteinDistance == null) {
return DEFAULT_MAX_LEVENSHTEIN_DISTANCE;
} else {
return maxLevenshteinDistance;
}
}
/**
* Sets the value of the maxLevenshteinDistance property.
*
* @param maxLevenshteinDistance
* allowed object is
* {@link Integer }
*
*/
public TextIndex setMaxLevenshteinDistance(Integer maxLevenshteinDistance) {
this.maxLevenshteinDistance = maxLevenshteinDistance;
return this;
}
/**
* Gets the value of the countHits property.
*
* @return
* possible object is
* {@link TextIndex.CountHits }
*
*/
public TextIndex.CountHits getCountHits() {
if (countHits == null) {
return TextIndex.CountHits.ALL_HITS;
} else {
return countHits;
}
}
/**
* Sets the value of the countHits property.
*
* @param countHits
* allowed object is
* {@link TextIndex.CountHits }
*
*/
public TextIndex setCountHits(TextIndex.CountHits countHits) {
this.countHits = countHits;
return this;
}
/**
* Gets the value of the wordSeparatorCharacterRE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getWordSeparatorCharacterRE() {
if (wordSeparatorCharacterRE == null) {
return "\\s";
} else {
return wordSeparatorCharacterRE;
}
}
/**
* Sets the value of the wordSeparatorCharacterRE property.
*
* @param wordSeparatorCharacterRE
* allowed object is
* {@link String }
*
*/
public TextIndex setWordSeparatorCharacterRE(String wordSeparatorCharacterRE) {
this.wordSeparatorCharacterRE = wordSeparatorCharacterRE;
return this;
}
/**
* Gets the value of the tokenize property.
*
* @return
* possible object is
* {@link Boolean }
*
*/
public boolean isTokenize() {
if (tokenize == null) {
return DEFAULT_TOKENIZE;
} else {
return tokenize;
}
}
/**
* Sets the value of the tokenize property.
*
* @param tokenize
* allowed object is
* {@link Boolean }
*
*/
public TextIndex setTokenize(Boolean tokenize) {
this.tokenize = tokenize;
return this;
}
/**
* Gets the value of the extensions property.
*
*
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a set
method for the extensions property.
*
*
* For example, to add a new item, do as follows:
*
* getExtensions().add(newItem);
*
*
*
*
* Objects of the following type(s) are allowed in the list
* {@link Extension }
*
*
*/
public List getExtensions() {
if (extensions == null) {
extensions = new ArrayList();
}
return this.extensions;
}
/**
* Gets the value of the textIndexNormalizations property.
*
*
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a set
method for the textIndexNormalizations property.
*
*
* For example, to add a new item, do as follows:
*
* getTextIndexNormalizations().add(newItem);
*
*
*
*
* Objects of the following type(s) are allowed in the list
* {@link TextIndexNormalization }
*
*
*/
public List getTextIndexNormalizations() {
if (textIndexNormalizations == null) {
textIndexNormalizations = new ArrayList();
}
return this.textIndexNormalizations;
}
/**
* Gets the value of the expression property.
*
* @return
* possible object is
* {@link Constant }
* {@link FieldRef }
* {@link NormContinuous }
* {@link NormDiscrete }
* {@link Discretize }
* {@link MapValues }
* {@link TextIndex }
* {@link Apply }
* {@link Aggregate }
* {@link Lag }
*
*/
public org.dmg.pmml.Expression getExpression() {
return expression;
}
/**
* Sets the value of the expression property.
*
* @param expression
* allowed object is
* {@link Constant }
* {@link FieldRef }
* {@link NormContinuous }
* {@link NormDiscrete }
* {@link Discretize }
* {@link MapValues }
* {@link TextIndex }
* {@link Apply }
* {@link Aggregate }
* {@link Lag }
*
*/
public TextIndex setExpression(org.dmg.pmml.Expression expression) {
this.expression = expression;
return this;
}
public boolean hasExtensions() {
return ((this.extensions!= null)&&(this.extensions.size()> 0));
}
public TextIndex addExtensions(Extension... extensions) {
getExtensions().addAll(Arrays.asList(extensions));
return this;
}
public boolean hasTextIndexNormalizations() {
return ((this.textIndexNormalizations!= null)&&(this.textIndexNormalizations.size()> 0));
}
public TextIndex addTextIndexNormalizations(TextIndexNormalization... textIndexNormalizations) {
getTextIndexNormalizations().addAll(Arrays.asList(textIndexNormalizations));
return this;
}
@Override
public VisitorAction accept(Visitor visitor) {
VisitorAction status = visitor.visit(this);
if (status == VisitorAction.CONTINUE) {
visitor.pushParent(this);
if ((status == VisitorAction.CONTINUE)&&hasExtensions()) {
status = PMMLObject.traverse(visitor, getExtensions());
}
if ((status == VisitorAction.CONTINUE)&&hasTextIndexNormalizations()) {
status = PMMLObject.traverse(visitor, getTextIndexNormalizations());
}
if (status == VisitorAction.CONTINUE) {
status = PMMLObject.traverse(visitor, getExpression());
}
visitor.popParent();
}
if (status == VisitorAction.TERMINATE) {
return VisitorAction.TERMINATE;
}
return VisitorAction.CONTINUE;
}
/**
* Java class for null.
*
*
The following schema fragment specifies the expected content contained within this class.
*
*
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <enumeration value="allHits"/>
* <enumeration value="bestHits"/>
* </restriction>
* </simpleType>
*
*
*/
@XmlType(name = "")
@XmlEnum
public enum CountHits {
@XmlEnumValue("allHits")
ALL_HITS("allHits"),
@XmlEnumValue("bestHits")
BEST_HITS("bestHits");
private final String value;
CountHits(String v) {
value = v;
}
public String value() {
return value;
}
public static TextIndex.CountHits fromValue(String v) {
for (TextIndex.CountHits c: TextIndex.CountHits.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
}
}
/**
* Java class for null.
*
*
The following schema fragment specifies the expected content contained within this class.
*
*
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <enumeration value="termFrequency"/>
* <enumeration value="binary"/>
* <enumeration value="logarithmic"/>
* <enumeration value="augmentedNormalizedTermFrequency"/>
* </restriction>
* </simpleType>
*
*
*/
@XmlType(name = "")
@XmlEnum
public enum LocalTermWeights {
@XmlEnumValue("termFrequency")
TERM_FREQUENCY("termFrequency"),
@XmlEnumValue("binary")
BINARY("binary"),
@XmlEnumValue("logarithmic")
LOGARITHMIC("logarithmic"),
@XmlEnumValue("augmentedNormalizedTermFrequency")
AUGMENTED_NORMALIZED_TERM_FREQUENCY("augmentedNormalizedTermFrequency");
private final String value;
LocalTermWeights(String v) {
value = v;
}
public String value() {
return value;
}
public static TextIndex.LocalTermWeights fromValue(String v) {
for (TextIndex.LocalTermWeights c: TextIndex.LocalTermWeights.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
}
}
}