/** Lemmatize the word, being sensitive to the tag. * Words other than proper nouns will be changed to all lowercase. * * @param word The word to lemmatize * @param tag What part of speech to assume for it. * @return The lemma for the word */ public static synchronized String lemmaStatic(String word, String tag) { return lemmaStatic(word, tag, true); }
/** * Create a new word, where the label is formed from * the {@code String} passed in. The String is divided according * to the divider character. We assume that we can always just * divide on the rightmost divider character, rather than trying to * parse up escape sequences. If the divider character isn't found * in the word, then the whole string becomes the word, and lemma and tag * are {@code null}. * We assume that if only one divider character is found, word and tag are presents in * the String, and lemma will be computed. * * @param labelStr The word that will go into the {@code Word} * @return The new WordLemmaTag */ @Override public Label newLabelFromString(String labelStr) { int first = labelStr.indexOf(divider); int second = labelStr.lastIndexOf(divider); if (first == second) { return new WordLemmaTag(labelStr.substring(0, first), Morphology.lemmaStatic(labelStr.substring(0, first), labelStr.substring(first + 1)), labelStr.substring(first + 1)); } else if (first >= 0) { return new WordLemmaTag(labelStr.substring(0, first), labelStr.substring(first + 1, second), labelStr.substring(second + 1)); } else { return new WordLemmaTag(labelStr); } }
public void setFromString(String labelStr, String divider) { int first = labelStr.indexOf(divider); int second = labelStr.lastIndexOf(divider); if (first == second) { setWord(labelStr.substring(0, first)); setTag(labelStr.substring(first + 1)); setLemma(Morphology.lemmaStatic(labelStr.substring(0, first), labelStr.substring(first + 1))); } else if (first >= 0) { setWord(labelStr.substring(0, first)); setLemma(labelStr.substring(first + 1, second)); setTag(labelStr.substring(second + 1)); } else { setWord(labelStr); setLemma(null); setTag(null); } }
/** * Given a {@code SemanticGraph}, sets the lemmas on its label * objects based on their word and tag. */ public static void lemmatize(SemanticGraph sg) { for (IndexedWord node : sg.vertexSet()) { node.setLemma(Morphology.lemmaStatic(node.word(), node.tag())); } }
} else { String lemma = Morphology.lemmaStatic(root.value(), root.tag()); if (lemma.matches(EnglishPatterns.NP_V_S_INF_VERBS_REGEX)) { reattach = true;
for(int i = arg1.getExtentTokenStart(); i < arg1.getExtentTokenEnd(); i ++) indecesToSkip.add(i + 1); for (IndexedWord node : pathNodes){ pathLemmas.add(Morphology.lemmaStatic(node.value(), node.tag(), true)); if(! indecesToSkip.contains(node.index())) noArgPathLemmas.add(Morphology.lemmaStatic(node.value(), node.tag(), true)); continue; String lemma = Morphology.lemmaStatic(node.value(), node.tag(), true); String node1Path = generalizedDependencyPath(graph.getShortestUndirectedPathEdges(node, node1), node); String node0Path = generalizedDependencyPath(graph.getShortestUndirectedPathEdges(node0, node), node0); continue; String lemma = Morphology.lemmaStatic(node.value(), node.tag(), true); String edge0str, edge1str; if (node0.equals(edge0.getGovernor())) { leftRelation = " <-" + generalizeRelation(leftEdge.getRelation()); String lemma = Morphology.lemmaStatic(node.value(), node.tag(), true);
String lemma = Morphology.lemmaStatic(root.value(), root.tag()); if (lemma != null && lemma.matches(EnglishPatterns.NP_V_S_INF_VERBS_REGEX)) { reattach = true;
/** Lemmatize the word, being sensitive to the tag. * Words other than proper nouns will be changed to all lowercase. * * @param word The word to lemmatize * @param tag What part of speech to assume for it. * @return The lemma for the word */ public static synchronized String lemmaStatic(String word, String tag) { return lemmaStatic(word, tag, true); }
public static synchronized String lemmaStaticSynchronized(String word, String tag, boolean lowercase) { return lemmaStatic(word, tag, lowercase); }
/** Lemmatize the word, being sensitive to the tag. * Words other than proper nouns will be changed to all lowercase. * * @param word The word to lemmatize * @param tag What part of speech to assume for it. * @return The lemma for the word */ public static synchronized String lemmaStatic(String word, String tag) { return lemmaStatic(word, tag, true); }
public static synchronized String lemmaStaticSynchronized(String word, String tag, boolean lowercase) { return lemmaStatic(word, tag, lowercase); }
/** * Create a new word, where the label is formed from * the {@code String} passed in. The String is divided according * to the divider character. We assume that we can always just * divide on the rightmost divider character, rather than trying to * parse up escape sequences. If the divider character isn't found * in the word, then the whole string becomes the word, and lemma and tag * are {@code null}. * We assume that if only one divider character is found, word and tag are presents in * the String, and lemma will be computed. * * @param labelStr The word that will go into the {@code Word} * @return The new WordLemmaTag */ @Override public Label newLabelFromString(String labelStr) { int first = labelStr.indexOf(divider); int second = labelStr.lastIndexOf(divider); if (first == second) { return new WordLemmaTag(labelStr.substring(0, first), Morphology.lemmaStatic(labelStr.substring(0, first), labelStr.substring(first + 1)), labelStr.substring(first + 1)); } else if (first >= 0) { return new WordLemmaTag(labelStr.substring(0, first), labelStr.substring(first + 1, second), labelStr.substring(second + 1)); } else { return new WordLemmaTag(labelStr); } }
/** * Create a new word, where the label is formed from * the {@code String} passed in. The String is divided according * to the divider character. We assume that we can always just * divide on the rightmost divider character, rather than trying to * parse up escape sequences. If the divider character isn't found * in the word, then the whole string becomes the word, and lemma and tag * are {@code null}. * We assume that if only one divider character is found, word and tag are presents in * the String, and lemma will be computed. * * @param labelStr The word that will go into the {@code Word} * @return The new WordLemmaTag */ @Override public Label newLabelFromString(String labelStr) { int first = labelStr.indexOf(divider); int second = labelStr.lastIndexOf(divider); if (first == second) { return new WordLemmaTag(labelStr.substring(0, first), Morphology.lemmaStatic(labelStr.substring(0, first), labelStr.substring(first + 1)), labelStr.substring(first + 1)); } else if (first >= 0) { return new WordLemmaTag(labelStr.substring(0, first), labelStr.substring(first + 1, second), labelStr.substring(second + 1)); } else { return new WordLemmaTag(labelStr); } }
public void setFromString(String labelStr, String divider) { int first = labelStr.indexOf(divider); int second = labelStr.lastIndexOf(divider); if (first == second) { setWord(labelStr.substring(0, first)); setTag(labelStr.substring(first + 1)); setLemma(Morphology.lemmaStatic(labelStr.substring(0, first), labelStr.substring(first + 1))); } else if (first >= 0) { setWord(labelStr.substring(0, first)); setLemma(labelStr.substring(first + 1, second)); setTag(labelStr.substring(second + 1)); } else { setWord(labelStr); setLemma(null); setTag(null); } }
public void setFromString(String labelStr, String divider) { int first = labelStr.indexOf(divider); int second = labelStr.lastIndexOf(divider); if (first == second) { setWord(labelStr.substring(0, first)); setTag(labelStr.substring(first + 1)); setLemma(Morphology.lemmaStatic(labelStr.substring(0, first), labelStr.substring(first + 1))); } else if (first >= 0) { setWord(labelStr.substring(0, first)); setLemma(labelStr.substring(first + 1, second)); setTag(labelStr.substring(second + 1)); } else { setWord(labelStr); setLemma(null); setTag(null); } }
/** * Given a {@code SemanticGraph}, sets the lemmas on its label * objects based on their word and tag. */ public static void lemmatize(SemanticGraph sg) { for (IndexedWord node : sg.vertexSet()) { node.setLemma(Morphology.lemmaStatic(node.word(), node.tag())); } }
/** * Given a {@code SemanticGraph}, sets the lemmas on its label * objects based on their word and tag. */ public static void lemmatize(SemanticGraph sg) { for (IndexedWord node : sg.vertexSet()) { node.setLemma(Morphology.lemmaStatic(node.word(), node.tag())); } }
} else { String lemma = Morphology.lemmaStatic(root.value(), root.tag()); if (lemma.matches(EnglishPatterns.NP_V_S_INF_VERBS_REGEX)) { reattach = true;
String lemma = Morphology.lemmaStatic(root.value(), root.tag()); if (lemma != null && lemma.matches(EnglishPatterns.NP_V_S_INF_VERBS_REGEX)) { reattach = true;
String lemma = Morphology.lemmaStatic(root.value(), root.tag()); if (lemma != null && lemma.matches(EnglishPatterns.NP_V_S_INF_VERBS_REGEX)) { reattach = true;