use of edu.illinois.cs.cogcomp.lbjava.classify.FeatureVector in project cogcomp-nlp by CogComp.
the class POSTaggerUnknown$$1 method classify.
public FeatureVector classify(Object __example) {
FeatureVector __result;
__result = new FeatureVector();
__result.addFeature(__wordForm.featureValue(__example));
__result.addFeature(__baselineTarget.featureValue(__example));
__result.addFeature(__labelTwoBeforeU.featureValue(__example));
__result.addFeature(__labelOneBeforeU.featureValue(__example));
__result.addFeature(__labelOneAfterU.featureValue(__example));
__result.addFeature(__labelTwoAfterU.featureValue(__example));
__result.addFeature(__L2bL1bU.featureValue(__example));
__result.addFeature(__L1bL1aU.featureValue(__example));
__result.addFeature(__L1aL2aU.featureValue(__example));
__result.addFeatures(__suffixFeatures.classify(__example));
return __result;
}
use of edu.illinois.cs.cogcomp.lbjava.classify.FeatureVector in project cogcomp-nlp by CogComp.
the class Formpp method classify.
public FeatureVector classify(Object __example) {
Token word = (Token) __example;
FeatureVector __result;
__result = new FeatureVector();
String __id;
String __value;
int before = 2;
int after = 2;
int k = 2;
int i;
Token w = word, last = word;
for (i = 0; i <= after && last != null; ++i) {
last = (Token) last.next;
}
for (i = 0; i > -before && w.previous != null; --i) {
w = (Token) w.previous;
}
String[] forms = new String[before + after + 1];
i = 0;
for (; w != last; w = (Token) w.next) {
forms[i++] = word.form;
}
for (int j = 0; j < k; j++) {
for (i = 0; i < forms.length; i++) {
StringBuilder f = new StringBuilder();
for (int context = 0; context <= j && i + context < forms.length; context++) {
if (context != 0) {
f.append("_");
}
f.append(forms[i + context]);
}
__id = "" + (i + "_" + j);
__value = "" + (f.toString());
__result.addFeature(new DiscretePrimitiveStringFeature(this.containingPackage, this.name, __id, __value, valueIndexOf(__value), (short) 0));
}
}
return __result;
}
use of edu.illinois.cs.cogcomp.lbjava.classify.FeatureVector in project cogcomp-nlp by CogComp.
the class Mixed method classify.
public FeatureVector classify(Object __example) {
Token word = (Token) __example;
FeatureVector __result;
__result = new FeatureVector();
String __id;
String __value;
int before = 2;
int after = 2;
int k = 2;
int i;
Token w = word, last = word;
for (i = 0; i <= after && last != null; ++i) {
last = (Token) last.next;
}
for (i = 0; i > -before && w.previous != null; --i) {
w = (Token) w.previous;
}
String[] tags = new String[before + after + 1];
String[] forms = new String[before + after + 1];
i = 0;
for (; w != last; w = (Token) w.next) {
tags[i] = __POSTagger.discreteValue(w);
forms[i] = w.form;
i++;
}
for (int j = 1; j < k; j++) {
for (int x = 0; x < 2; x++) {
boolean t = true;
for (i = 0; i < tags.length; i++) {
StringBuilder f = new StringBuilder();
for (int context = 0; context <= j && i + context < tags.length; context++) {
if (context != 0) {
f.append("_");
}
if (t && x == 0) {
f.append(tags[i + context]);
} else {
f.append(forms[i + context]);
}
t = !t;
}
__id = "" + (i + "_" + j);
__value = "" + (f.toString());
__result.addFeature(new DiscretePrimitiveStringFeature(this.containingPackage, this.name, __id, __value, valueIndexOf(__value), (short) 0));
}
}
}
return __result;
}
use of edu.illinois.cs.cogcomp.lbjava.classify.FeatureVector in project cogcomp-nlp by CogComp.
the class POSWindowpp method classify.
public FeatureVector classify(Object __example) {
Token word = (Token) __example;
FeatureVector __result;
__result = new FeatureVector();
String __id;
String __value;
int before = 3;
int after = 3;
int k = 3;
int i;
Token w = word, last = word;
for (i = 0; i <= after && last != null; ++i) {
last = (Token) last.next;
}
for (i = 0; i > -before && w.previous != null; --i) {
w = (Token) w.previous;
}
String[] tags = new String[before + after + 1];
i = 0;
for (; w != last; w = (Token) w.next) {
tags[i++] = __POSTagger.discreteValue(w);
}
for (int j = 0; j < k; j++) {
for (i = 0; i < tags.length; i++) {
StringBuilder f = new StringBuilder();
for (int context = 0; context <= j && i + context < tags.length; context++) {
if (context != 0) {
f.append("_");
}
f.append(tags[i + context]);
}
__id = "" + (i + "_" + j);
__value = "" + (f.toString());
__result.addFeature(new DiscretePrimitiveStringFeature(this.containingPackage, this.name, __id, __value, valueIndexOf(__value), (short) 0));
}
}
return __result;
}
use of edu.illinois.cs.cogcomp.lbjava.classify.FeatureVector in project cogcomp-nlp by CogComp.
the class Capitalization method classify.
public FeatureVector classify(Object __example) {
if (!(__example instanceof Word)) {
String type = __example == null ? "null" : __example.getClass().getName();
logger.error("Classifier 'Capitalization(Word)' defined on line 45 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 i;
Word w = word, last = word;
for (i = 0; i <= 2 && last != null; ++i) {
last = (Word) last.next;
}
for (i = 0; i > -2 && w.previous != null; --i) {
w = (Word) w.previous;
}
for (; w != last; w = (Word) w.next) {
__id = "" + (i++);
__value = "" + (w.capitalized);
__result.addFeature(new DiscretePrimitiveStringFeature(this.containingPackage, this.name, __id, __value, valueIndexOf(__value), (short) 2));
}
return __result;
}
Aggregations