/** Does {@code pattern} matched as rule patternRuleIndex match tree? Pass in a * compiled pattern instead of a string representation of a tree pattern. */ public boolean matches(ParseTree tree, ParseTreePattern pattern) { MultiMap<String, ParseTree> labels = new MultiMap<String, ParseTree>(); ParseTree mismatchedNode = matchImpl(tree, pattern.getPatternTree(), labels); return mismatchedNode == null; }
/** * Compare {@code pattern} matched against {@code tree} and return a * {@link ParseTreeMatch} object that contains the matched elements, or the * node at which the match failed. Pass in a compiled pattern instead of a * string representation of a tree pattern. */ public ParseTreeMatch match(ParseTree tree, ParseTreePattern pattern) { MultiMap<String, ParseTree> labels = new MultiMap<String, ParseTree>(); ParseTree mismatchedNode = matchImpl(tree, pattern.getPatternTree(), labels); return new ParseTreeMatch(tree, pattern, labels, mismatchedNode); }
@Override public boolean defineRule(Rule r) { if (!super.defineRule(r)) { return false; } if ( modes==null ) modes = new MultiMap<String, Rule>(); modes.map(r.mode, r); return true; }
@Override public boolean defineRule(Rule r) { if (!super.defineRule(r)) { return false; } if ( modes==null ) modes = new MultiMap<String, Rule>(); modes.map(r.mode, r); return true; }
/** Does {@code pattern} matched as rule patternRuleIndex match tree? Pass in a * compiled pattern instead of a string representation of a tree pattern. */ public boolean matches(ParseTree tree, ParseTreePattern pattern) { MultiMap<String, ParseTree> labels = new MultiMap<String, ParseTree>(); ParseTree mismatchedNode = matchImpl(tree, pattern.getPatternTree(), labels); return mismatchedNode == null; }
@Override public boolean defineRule(Rule r) { if (!super.defineRule(r)) { return false; } if ( modes==null ) modes = new MultiMap<String, Rule>(); modes.map(r.mode, r); return true; }
@Override public boolean defineRule(Rule r) { if (!super.defineRule(r)) { return false; } if ( modes==null ) modes = new MultiMap<String, Rule>(); modes.map(r.mode, r); return true; }
/** Does {@code pattern} matched as rule patternRuleIndex match tree? Pass in a * compiled pattern instead of a string representation of a tree pattern. */ public boolean matches(ParseTree tree, ParseTreePattern pattern) { MultiMap<String, ParseTree> labels = new MultiMap<String, ParseTree>(); ParseTree mismatchedNode = matchImpl(tree, pattern.getPatternTree(), labels); return mismatchedNode == null; }
/** Does {@code pattern} matched as rule patternRuleIndex match tree? Pass in a * compiled pattern instead of a string representation of a tree pattern. */ public boolean matches(ParseTree tree, ParseTreePattern pattern) { MultiMap<String, ParseTree> labels = new MultiMap<String, ParseTree>(); ParseTree mismatchedNode = matchImpl(tree, pattern.getPatternTree(), labels); return mismatchedNode == null; }
@Override public boolean defineRule(Rule r) { if (!super.defineRule(r)) { return false; } if ( modes==null ) modes = new MultiMap<String, Rule>(); modes.map(r.mode, r); return true; }
/** Does {@code pattern} matched as rule patternRuleIndex match tree? Pass in a * compiled pattern instead of a string representation of a tree pattern. */ public boolean matches(ParseTree tree, ParseTreePattern pattern) { MultiMap<String, ParseTree> labels = new MultiMap<String, ParseTree>(); ParseTree mismatchedNode = matchImpl(tree, pattern.getPatternTree(), labels); return mismatchedNode == null; }
public void buildTokenContextIndex() { curAndPrevTokenRuleIndexToExemplarIndexes = new MultiMap<>(); wsFeaturesToExemplarIndexes = new MultiMap<>(); hposFeaturesToExemplarIndexes = new MultiMap<>(); for (int i = 0; i<featureVectors.size(); i++) { int[] features = featureVectors.get(i); int curTokenRuleIndex = features[Trainer.INDEX_PREV_EARLIEST_RIGHT_ANCESTOR]; int prevTokenRuleIndex = features[Trainer.INDEX_EARLIEST_LEFT_ANCESTOR]; int pr = Trainer.unrulealt(prevTokenRuleIndex)[0]; int cr = Trainer.unrulealt(curTokenRuleIndex)[0]; curAndPrevTokenRuleIndexToExemplarIndexes.map(new Pair<>(pr, cr), i); wsFeaturesToExemplarIndexes.map(new FeatureVectorAsObject(features, Trainer.FEATURES_INJECT_WS), i); hposFeaturesToExemplarIndexes.map(new FeatureVectorAsObject(features, Trainer.FEATURES_HPOS), i); } } }
public MultiMap<String, LabelElementPair> getElementLabelDefs() { MultiMap<String, LabelElementPair> defs = new MultiMap<String, LabelElementPair>(); for (int i=1; i<=numberOfAlts; i++) { for (List<LabelElementPair> pairs : alt[i].labelDefs.values()) { for (LabelElementPair p : pairs) { defs.map(p.label.getText(), p); } } } return defs; }
/** * Compare {@code pattern} matched against {@code tree} and return a * {@link ParseTreeMatch} object that contains the matched elements, or the * node at which the match failed. Pass in a compiled pattern instead of a * string representation of a tree pattern. */ public ParseTreeMatch match(ParseTree tree, ParseTreePattern pattern) { MultiMap<String, ParseTree> labels = new MultiMap<String, ParseTree>(); ParseTree mismatchedNode = matchImpl(tree, pattern.getPatternTree(), labels); return new ParseTreeMatch(tree, pattern, labels, mismatchedNode); }
/** * Compare {@code pattern} matched against {@code tree} and return a * {@link ParseTreeMatch} object that contains the matched elements, or the * node at which the match failed. Pass in a compiled pattern instead of a * string representation of a tree pattern. */ public ParseTreeMatch match(ParseTree tree, ParseTreePattern pattern) { MultiMap<String, ParseTree> labels = new MultiMap<String, ParseTree>(); ParseTree mismatchedNode = matchImpl(tree, pattern.getPatternTree(), labels); return new ParseTreeMatch(tree, pattern, labels, mismatchedNode); }
/** * Compare {@code pattern} matched against {@code tree} and return a * {@link ParseTreeMatch} object that contains the matched elements, or the * node at which the match failed. Pass in a compiled pattern instead of a * string representation of a tree pattern. */ public ParseTreeMatch match(ParseTree tree, ParseTreePattern pattern) { MultiMap<String, ParseTree> labels = new MultiMap<String, ParseTree>(); ParseTree mismatchedNode = matchImpl(tree, pattern.getPatternTree(), labels); return new ParseTreeMatch(tree, pattern, labels, mismatchedNode); }
MultiMap<String, File> grammarFileByFolder = new MultiMap<String, File>();
/** * Compare {@code pattern} matched against {@code tree} and return a * {@link ParseTreeMatch} object that contains the matched elements, or the * node at which the match failed. Pass in a compiled pattern instead of a * string representation of a tree pattern. */ @NotNull public ParseTreeMatch match(@NotNull ParseTree tree, @NotNull ParseTreePattern pattern) { MultiMap<String, ParseTree> labels = new MultiMap<String, ParseTree>(); ParseTree mismatchedNode = matchImpl(tree, pattern.getPatternTree(), labels); return new ParseTreeMatch(tree, pattern, labels, mismatchedNode); }
corpus.train(); MultiMap<FeatureVectorAsObject,Integer> wsContextToIndex = new MultiMap<>(); MultiMap<FeatureVectorAsObject,Integer> hposContextToIndex = new MultiMap<>(); MultiMap<Integer,Integer> wsCatToIndexes = new MultiMap<>(); for (Integer i : exemplarIndexes) { wsCatToIndexes.map(corpus.injectWhitespace.get(i), i); MultiMap<Integer,Integer> hposCatToIndexes = new MultiMap<>(); for (Integer i : exemplarIndexes) { hposCatToIndexes.map(corpus.hpos.get(i), i);