diff --git a/compling.core/source/compling/grammar/ecg/Grammar.java b/compling.core/source/compling/grammar/ecg/Grammar.java index e0c8016..03acaed 100644 --- a/compling.core/source/compling/grammar/ecg/Grammar.java +++ b/compling.core/source/compling/grammar/ecg/Grammar.java @@ -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); diff --git a/compling.core/source/compling/grammar/ecg/GrammarChecker.java b/compling.core/source/compling/grammar/ecg/GrammarChecker.java index e535d45..b5459fe 100644 --- a/compling.core/source/compling/grammar/ecg/GrammarChecker.java +++ b/compling.core/source/compling/grammar/ecg/GrammarChecker.java @@ -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 @@ -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); @@ -648,6 +660,7 @@ private static void updateRoles(Primitive primitive, Set 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)) { diff --git a/compling.core/source/compling/grammar/unificationgrammar/UnificationGrammar.java b/compling.core/source/compling/grammar/unificationgrammar/UnificationGrammar.java index 7871a7e..afb9321 100644 --- a/compling.core/source/compling/grammar/unificationgrammar/UnificationGrammar.java +++ b/compling.core/source/compling/grammar/unificationgrammar/UnificationGrammar.java @@ -251,6 +251,7 @@ public Constraint(String operator, List arguments) { this.operator = operator; this.arguments = arguments; } + public Constraint(String operator, SlotChain arg1, SlotChain arg2) { arguments = new ArrayList(); diff --git a/compling.core/source/compling/parser/ecgparser/LeftCornerParser.java b/compling.core/source/compling/parser/ecgparser/LeftCornerParser.java index e07fa50..0a1eb19 100644 --- a/compling.core/source/compling/parser/ecgparser/LeftCornerParser.java +++ b/compling.core/source/compling/parser/ecgparser/LeftCornerParser.java @@ -401,6 +401,7 @@ public PriorityQueue> getBestPartialParses(Utterance utter List 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;