use of edu.illinois.cs.cogcomp.comma.datastructures.Comma in project cogcomp-nlp by CogComp.
the class ParseTreeFeature method discreteValue.
public String discreteValue(Object __example) {
if (!(__example instanceof Comma)) {
String type = __example == null ? "null" : __example.getClass().getName();
System.err.println("Classifier 'ParseTreeFeature(Comma)' defined on line 75 of CommaClassifier.lbj received '" + type + "' as input.");
new Exception().printStackTrace();
System.exit(1);
}
Comma c = (Comma) __example;
String tree = "";
int distance = 0;
String phrase;
do {
phrase = c.getNotation(c.getPhraseToLeftOfParent(distance));
tree = phrase + tree;
distance++;
} while (!phrase.equals("NULL"));
String commaLevelPhrases = "";
distance = 0;
do {
phrase = c.getNotation(c.getPhraseToLeftOfComma(distance));
commaLevelPhrases = phrase + commaLevelPhrases;
distance++;
} while (!phrase.equals("NULL"));
distance = 1;
do {
phrase = c.getNotation(c.getPhraseToRightOfComma(distance));
commaLevelPhrases = commaLevelPhrases + phrase;
distance++;
} while (!phrase.equals("NULL"));
tree += "(" + commaLevelPhrases + ")";
distance = 1;
do {
phrase = c.getNotation(c.getPhraseToRightOfParent(distance));
tree = tree + phrase;
distance++;
} while (!phrase.equals("NULL"));
return "" + (tree);
}
use of edu.illinois.cs.cogcomp.comma.datastructures.Comma in project cogcomp-nlp by CogComp.
the class RightToLeftDependencies method classify.
public FeatureVector classify(Object __example) {
if (!(__example instanceof Comma)) {
String type = __example == null ? "null" : __example.getClass().getName();
System.err.println("Classifier 'RightToLeftDependencies(Comma)' defined on line 59 of CommaClassifier.lbj received '" + type + "' as input.");
new Exception().printStackTrace();
System.exit(1);
}
Comma c = (Comma) __example;
FeatureVector __result;
__result = new FeatureVector();
String __id;
String __value;
String[] rtol = c.getLeftToRightDependencies();
for (int i = 0; i < rtol.length; i++) {
__id = "" + (rtol[i]);
__value = "true";
__result.addFeature(new DiscretePrimitiveStringFeature(this.containingPackage, this.name, __id, __value, valueIndexOf(__value), (short) 0));
}
return __result;
}
use of edu.illinois.cs.cogcomp.comma.datastructures.Comma in project cogcomp-nlp by CogComp.
the class SRLFeature method classify.
public FeatureVector classify(Object __example) {
if (!(__example instanceof Comma)) {
String type = __example == null ? "null" : __example.getClass().getName();
System.err.println("Classifier 'SRLFeature(Comma)' defined on line 66 of CommaClassifier.lbj received '" + type + "' as input.");
new Exception().printStackTrace();
System.exit(1);
}
Comma c = (Comma) __example;
FeatureVector __result;
__result = new FeatureVector();
String __id;
String __value;
List SRLs = c.getContainingSRLs();
for (int i = 0; i < SRLs.size(); i++) {
String s = (String) SRLs.get(i);
__id = "" + (s);
__value = "true";
__result.addFeature(new DiscretePrimitiveStringFeature(this.containingPackage, this.name, __id, __value, valueIndexOf(__value), (short) 0));
}
return __result;
}
use of edu.illinois.cs.cogcomp.comma.datastructures.Comma in project cogcomp-nlp by CogComp.
the class UnigramRightFeature method discreteValue.
public String discreteValue(Object __example) {
if (!(__example instanceof Comma)) {
String type = __example == null ? "null" : __example.getClass().getName();
System.err.println("Classifier 'UnigramRightFeature(Comma)' defined on line 14 of CommaClassifier.lbj received '" + type + "' as input.");
new Exception().printStackTrace();
System.exit(1);
}
Comma c = (Comma) __example;
return "" + (c.getWordToRight(1));
}
use of edu.illinois.cs.cogcomp.comma.datastructures.Comma in project cogcomp-nlp by CogComp.
the class listCommas method discreteValue.
public String discreteValue(Object __example) {
if (!(__example instanceof CommaSRLSentence)) {
String type = __example == null ? "null" : __example.getClass().getName();
System.err.println("Constraint 'listCommas(CommaSRLSentence)' defined on line 244 of CommaClassifier.lbj received '" + type + "' as input.");
new Exception().printStackTrace();
System.exit(1);
}
CommaSRLSentence s = (CommaSRLSentence) __example;
{
boolean LBJava$constraint$result$0;
{
LBJava$constraint$result$0 = true;
for (java.util.Iterator __I0 = (s.getMiddleSiblingCommas()).iterator(); __I0.hasNext() && LBJava$constraint$result$0; ) {
Comma c = (Comma) __I0.next();
{
boolean LBJava$constraint$result$1;
{
boolean LBJava$constraint$result$2;
LBJava$constraint$result$2 = ("" + (__LocalCommaClassifier.discreteValue(s.getPreviousSiblingComma(c)))).equals("" + ("List"));
if (LBJava$constraint$result$2)
LBJava$constraint$result$1 = ("" + (__LocalCommaClassifier.discreteValue(s.getNextSiblingComma(c)))).equals("" + ("List"));
else
LBJava$constraint$result$1 = false;
}
if (LBJava$constraint$result$1)
LBJava$constraint$result$0 = ("" + (__LocalCommaClassifier.discreteValue(c))).equals("" + ("List"));
else
LBJava$constraint$result$0 = true;
}
}
}
if (!LBJava$constraint$result$0)
return "false";
}
return "true";
}
Aggregations