use of edu.illinois.cs.cogcomp.comma.datastructures.Comma in project cogcomp-nlp by CogComp.
the class locativePairMiddleCommas method makeConstraint.
public FirstOrderConstraint makeConstraint(Object __example) {
if (!(__example instanceof CommaSRLSentence)) {
String type = __example == null ? "null" : __example.getClass().getName();
System.err.println("Constraint 'locativePairMiddleCommas(CommaSRLSentence)' defined on line 220 of CommaClassifier.lbj received '" + type + "' as input.");
new Exception().printStackTrace();
System.exit(1);
}
CommaSRLSentence s = (CommaSRLSentence) __example;
FirstOrderConstraint __result = new FirstOrderConstant(true);
{
Object[] LBJ$constraint$context = new Object[1];
LBJ$constraint$context[0] = s;
FirstOrderConstraint LBJava$constraint$result$0 = null;
{
FirstOrderConstraint LBJava$constraint$result$1 = null;
{
FirstOrderConstraint LBJava$constraint$result$2 = null;
{
EqualityArgumentReplacer LBJ$EAR = new EqualityArgumentReplacer(LBJ$constraint$context, true) {
public Object getLeftObject() {
Comma c = (Comma) quantificationVariables.get(0);
return c;
}
};
LBJava$constraint$result$2 = new FirstOrderEqualityWithValue(true, new FirstOrderVariable(__LocalCommaClassifier, null), "" + ("Locative"), LBJ$EAR);
}
FirstOrderConstraint LBJava$constraint$result$3 = null;
{
FirstOrderConstraint LBJava$constraint$result$4 = null;
{
EqualityArgumentReplacer LBJ$EAR = new EqualityArgumentReplacer(LBJ$constraint$context, true) {
public Object getLeftObject() {
CommaSRLSentence s = (CommaSRLSentence) context[0];
Comma c = (Comma) quantificationVariables.get(0);
return s.getNextSiblingComma(c);
}
};
LBJava$constraint$result$4 = new FirstOrderEqualityWithValue(true, new FirstOrderVariable(__LocalCommaClassifier, null), "" + ("Locative"), LBJ$EAR);
}
FirstOrderConstraint LBJava$constraint$result$5 = null;
{
EqualityArgumentReplacer LBJ$EAR = new EqualityArgumentReplacer(LBJ$constraint$context, true) {
public Object getLeftObject() {
CommaSRLSentence s = (CommaSRLSentence) context[0];
Comma c = (Comma) quantificationVariables.get(0);
return s.getPreviousSiblingComma(c);
}
};
LBJava$constraint$result$5 = new FirstOrderEqualityWithValue(true, new FirstOrderVariable(__LocalCommaClassifier, null), "" + ("Locative"), LBJ$EAR);
}
LBJava$constraint$result$3 = new FirstOrderDisjunction(LBJava$constraint$result$4, LBJava$constraint$result$5);
}
LBJava$constraint$result$1 = new FirstOrderImplication(LBJava$constraint$result$2, LBJava$constraint$result$3);
}
LBJava$constraint$result$0 = new UniversalQuantifier("c", s.getMiddleSiblingCommas(), LBJava$constraint$result$1);
}
__result = new FirstOrderConjunction(__result, LBJava$constraint$result$0);
}
return __result;
}
use of edu.illinois.cs.cogcomp.comma.datastructures.Comma in project cogcomp-nlp by CogComp.
the class oxfordComma method discreteValue.
public String discreteValue(Object __example) {
if (!(__example instanceof CommaSRLSentence)) {
String type = __example == null ? "null" : __example.getClass().getName();
System.err.println("Constraint 'oxfordComma(CommaSRLSentence)' defined on line 236 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.getCommas()).iterator(); __I0.hasNext() && LBJava$constraint$result$0; ) {
Comma c = (Comma) __I0.next();
{
boolean LBJava$constraint$result$1;
LBJava$constraint$result$1 = ("" + (__UnigramRightFeature.discreteValue(c))).equals("" + ("and"));
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";
}
use of edu.illinois.cs.cogcomp.comma.datastructures.Comma in project cogcomp-nlp by CogComp.
the class BayraktarPatternFeature method discreteValue.
public String discreteValue(Object __example) {
if (!(__example instanceof Comma)) {
String type = __example == null ? "null" : __example.getClass().getName();
System.err.println("Classifier 'BayraktarPatternFeature(Comma)' defined on line 169 of CommaClassifier.lbj received '" + type + "' as input.");
new Exception().printStackTrace();
System.exit(1);
}
Comma c = (Comma) __example;
return "" + (c.getBayraktarPattern());
}
use of edu.illinois.cs.cogcomp.comma.datastructures.Comma in project cogcomp-nlp by CogComp.
the class ListCommasConstrainedCommaClassifier method discreteValue.
public String discreteValue(Object __example) {
if (!(__example instanceof Comma)) {
String type = __example == null ? "null" : __example.getClass().getName();
System.err.println("Classifier 'ListCommasConstrainedCommaClassifier(Comma)' defined on line 284 of CommaClassifier.lbj received '" + type + "' as input.");
new Exception().printStackTrace();
System.exit(1);
}
CommaSRLSentence head = ListCommasConstrainedInference.findHead((Comma) __example);
ListCommasConstrainedInference inference = (ListCommasConstrainedInference) InferenceManager.get("edu.illinois.cs.cogcomp.comma.lbj.ListCommasConstrainedInference", head);
if (inference == null) {
inference = new ListCommasConstrainedInference(head);
InferenceManager.put(inference);
}
String result = null;
try {
result = inference.valueOf(__LocalCommaClassifier, __example);
} catch (Exception e) {
System.err.println("LBJava ERROR: Fatal error while evaluating classifier ListCommasConstrainedCommaClassifier: " + e);
e.printStackTrace();
System.exit(1);
}
return result;
}
use of edu.illinois.cs.cogcomp.comma.datastructures.Comma in project cogcomp-nlp by CogComp.
the class SiblingPhraseFeatures method classify.
public FeatureVector classify(Object __example) {
if (!(__example instanceof Comma)) {
String type = __example == null ? "null" : __example.getClass().getName();
System.err.println("Classifier 'SiblingPhraseFeatures(Comma)' defined on line 40 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[] ngrams = c.getSiblingPhraseNgrams();
for (int i = 0; i < ngrams.length; i++) {
__id = "" + (ngrams[i]);
__value = "true";
__result.addFeature(new DiscretePrimitiveStringFeature(this.containingPackage, this.name, __id, __value, valueIndexOf(__value), (short) 0));
}
return __result;
}
Aggregations