static final boolean DEBUG = false;
public FilterConfusingRules(LexicalizedParser parser) {
BinaryGrammar binaryGrammar = parser.bg;
UnaryGrammar unaryGrammar = parser.ug;
Options op = parser.getOp();
Index<String> stateIndex = parser.stateIndex;
for (UnaryRule unaryRule : unaryGrammar) {
// only make one matrix for each parent state, and only use the
// basic category for that
String childState = stateIndex.get(unaryRule.child);
String childBasic = op.langpack().basicCategory(childState);
unaryRules.add(childBasic);
}
for (BinaryRule binaryRule : binaryGrammar) {
// only make one matrix for each parent state, and only use the
// basic category for that
String leftState = stateIndex.get(binaryRule.leftChild);
String leftBasic = op.langpack().basicCategory(leftState);
String rightState = stateIndex.get(binaryRule.rightChild);
String rightBasic = op.langpack().basicCategory(rightState);
binaryRules.add(leftBasic, rightBasic);
}
if (DEBUG) {