Skip to content

Commit

Permalink
Fixed first constraint problem, doing testing now.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Trott committed Jun 23, 2015
1 parent 0f5464a commit 2526940
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
9 changes: 9 additions & 0 deletions compling.core/source/compling/grammar/ecg/Grammar.java
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,15 @@ public Block(String kind, String type) {
this.kind = kind;
this.type = type;
}


public String toString() {
StringBuffer formatted = new StringBuffer();
for (Constraint c : constraints) {
formatted.append(c.toString() + "\n");
}
return formatted.toString();
}

public Block clone() {
return clone(true);
Expand Down
15 changes: 14 additions & 1 deletion compling.core/source/compling/grammar/ecg/GrammarChecker.java
Original file line number Diff line number Diff line change
Expand Up @@ -608,9 +608,20 @@ private static void addParentInfo(Block child, Block parent, Primitive childPrim
for (SlotChain sc : c.getArguments()) {
newArgs.add(new ECGSlotChain(sc.toString()));
}
Constraint newConstraint = new Constraint(c.getOperator(), c.getSource(), c.getValue(), c.overridden(), newArgs);
//if (!newConstraint.get)
boolean found = true;
// seantrott: added check for constraints
for (Constraint c2 : child.getConstraints()) {
if (c2.getArguments().get(0).toString().equals(c.getArguments().get(0).toString())) {
found = false;
}
}
if (found) {
child.getConstraints().add(
new Constraint(c.getOperator(), c.getSource(), c.getValue(), c.overridden(),
newArgs));
}
}
// =======
// private static void addParentInfo(Block child, Block parent, String
Expand All @@ -624,7 +635,8 @@ private static void addParentInfo(Block child, Block parent, Primitive childPrim
// c.getSource(), c.getValue(), c.overridden(), newArgs));
// }
// >>>>>>> 1.29
child.getConstraints().addAll(parent.getConstraints());
// TODO: This is a big thing to comment out. Check.
//child.getConstraints().addAll(parent.getConstraints());
addInheritedRoles(child.getElements(), parent.getElements(), childPrimitive, errorListener);
addInheritedRoles(child.getEvokedElements(), parent.getEvokedElements(), childPrimitive,
errorListener);
Expand All @@ -648,6 +660,7 @@ private static void updateRoles(Primitive primitive, Set<Role> roles, TypeSystem
Grammar g, IErrorListener errorListener) {
String source = primitive.getName();
for (Role r : roles) {

r.setSource(source);
if (r.getName().equals(ECGConstants.FORM_POLE)
|| r.getName().equals(ECGConstants.MEANING_POLE)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ public Constraint(String operator, List<SlotChain> arguments) {
this.operator = operator;
this.arguments = arguments;
}


public Constraint(String operator, SlotChain arg1, SlotChain arg2) {
arguments = new ArrayList<SlotChain>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ public PriorityQueue<List<T>> getBestPartialParses(Utterance<Word, String> utter
List<ECGToken> tokens = this.tokenReader.getToken(lemma);
for (ECGToken token : tokens) {
Construction parent = token.parent;

String[] inflections = morpher.getInflections(lemma, wordform);
for (String inf : inflections) {
//int what = this.meaning_morphTable.get(inf).length - 1;
Expand Down

0 comments on commit 2526940

Please sign in to comment.