// Modifying this comment will cause the next execution of LBJ2 to overwrite this file. // F1B88000000000000000D9D81CA02C04C044F7568280B5A6B82A727B51CF18E5DBB63B530AB59DCA8286FFDD4B70154CB8402162999CB6856F1822D40B17E8F64266BD586075D692ACC1770BF88A15D8BA2C571E45C19C7B1F0625B0590338185D0B0BA3ACA0B4B8C23E4788A389FE816D81FA24E5809C9F19065F6FD5E2B39818D7B6663553A54FA5F10A9FF7029F90AA19FB84DF31D1AE31D321100000 package LBJ2.nlp; import LBJ2.classify.*; import LBJ2.infer.*; import LBJ2.jni.*; import LBJ2.learn.*; import LBJ2.parse.*; /** * This class implements a classifier that takes a {@link Word} as input and * generates features representing the prefixes and suffixes of the input * word. The generated features include prefixes of length 3 and 4 and * suffixes of lengths 1 through 4 of the input word only. If any of those * words do not exist, the corresponding features aren't generated. * * <p> This class's implementation was automatically generated by the LBJ * compiler. * * @author Nick Rizzolo **/ public class Affixes extends Classifier { public Affixes() { containingPackage = "LBJ2.nlp"; name = "Affixes"; } public String getInputType() { return "LBJ2.nlp.Word"; } public String getOutputType() { return "discrete%"; } public FeatureVector classify(Object __example) { if (!(__example instanceof Word)) { String type = __example == null ? "null" : __example.getClass().getName(); System.err.println("Classifier 'Affixes(Word)' defined on line 107 of CommonFeatures.lbj received '" + type + "' as input."); new Exception().printStackTrace(); System.exit(1); } Word word = (Word) __example; FeatureVector __result; __result = new FeatureVector(); String __id; String __value; int N = word.form.length(); for (int i = 3; i <= 4; ++i) { if (word.form.length() > i) { __id = "p|"; __value = "" + (word.form.substring(0, i)); __result.addFeature(new DiscretePrimitiveStringFeature(this.containingPackage, this.name, __id, __value, valueIndexOf(__value), (short) 0)); } } for (int i = 1; i <= 4; ++i) { if (word.form.length() > i) { __id = "s|"; __value = "" + (word.form.substring(N - i)); __result.addFeature(new DiscretePrimitiveStringFeature(this.containingPackage, this.name, __id, __value, valueIndexOf(__value), (short) 0)); } } return __result; } public FeatureVector[] classify(Object[] examples) { if (!(examples instanceof Word[])) { String type = examples == null ? "null" : examples.getClass().getName(); System.err.println("Classifier 'Affixes(Word)' defined on line 107 of CommonFeatures.lbj received '" + type + "' as input."); new Exception().printStackTrace(); System.exit(1); } return super.classify(examples); } public int hashCode() { return "Affixes".hashCode(); } public boolean equals(Object o) { return o instanceof Affixes; } }