@Test public void testParsePhraseCharniak() throws Exception { ParsePhraseTypeOnly charniak = ParsePhraseTypeOnly.CHARNIAK; assertEquals("[VBD]", charniak.getFeatures(predicate).toString()); assertEquals("[NP]", charniak.getFeatures(arg1).toString()); assertEquals("[PP]", charniak.getFeatures(arg2).toString()); }
@Override public Set<Feature> getFeatures(Constituent c) throws EdisonException { TextAnnotation ta = c.getTextAnnotation(); TreeView tree = (TreeView) ta.getView(parseViewname); Constituent phrase; try { phrase = tree.getParsePhrase(c); } catch (Exception e) { throw new EdisonException(e); } Set<Feature> features = new LinkedHashSet<>(); if (phrase != null) features.add(DiscreteFeature.create(phrase.getLabel())); return features; }
ParsePhraseTypeOnly implements FeatureExtractor { @Override public Set<Feature> getFeatures(Constituent c) throws EdisonException { TextAnnotation ta = c.getTextAnnotation(); TreeView tree = (TreeView) ta.getView(parseViewname); Constituent phrase; try { phrase = tree.getParsePhrase(c); } catch (Exception e) { throw new EdisonException(e); } Set<Feature> features = new LinkedHashSet<>(); if (phrase != null) features.add(DiscreteFeature.create(phrase.getLabel())); return features; } }
ParsePhraseTypeOnly implements FeatureExtractor { @Override public Set<Feature> getFeatures(Constituent c) throws EdisonException { TextAnnotation ta = c.getTextAnnotation(); TreeView tree = (TreeView) ta.getView(parseViewname); Constituent phrase; try { phrase = tree.getParsePhrase(c); } catch (Exception e) { throw new EdisonException(e); } Set<Feature> features = new LinkedHashSet<>(); if (phrase != null) features.add(DiscreteFeature.create(phrase.getLabel())); return features; } ParsePhraseTypeOnly(String parseViewname); }
ParsePhraseTypeOnly implements FeatureExtractor { @Override public Set<Feature> getFeatures(Constituent c) throws EdisonException { TextAnnotation ta = c.getTextAnnotation(); TreeView tree = (TreeView) ta.getView(parseViewname); Constituent phrase; try { phrase = tree.getParsePhrase(c); } catch (Exception e) { throw new EdisonException(e); } Set<Feature> features = new LinkedHashSet<>(); if (phrase != null) features.add(DiscreteFeature.create(phrase.getLabel())); return features; } ParsePhraseTypeOnly(String parseViewname); @Override Set<Feature> getFeatures(Constituent c); @Override String getName(); }
ParsePhraseTypeOnly implements FeatureExtractor { @Override public Set<Feature> getFeatures(Constituent c) throws EdisonException { TextAnnotation ta = c.getTextAnnotation(); TreeView tree = (TreeView) ta.getView(parseViewname); Constituent phrase; try { phrase = tree.getParsePhrase(c); } catch (Exception e) { throw new EdisonException(e); } Set<Feature> features = new LinkedHashSet<>(); if (phrase != null) features.add(DiscreteFeature.create(phrase.getLabel())); return features; } ParsePhraseTypeOnly(String parseViewname); @Override Set<Feature> getFeatures(Constituent c); @Override String getName(); static ParsePhraseTypeOnly CHARNIAK; static ParsePhraseTypeOnly STANFORD; }