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); } }
/** * Create a new {@code WordLemmaTag} from a Label. The value of the Label corresponds to the word * of the WordLemmaTag. * * @param word This word is passed to the supertype constructor * @param tag The {@code value()} of this Label is set as the tag of this Label */ public WordLemmaTag(Label word, Label tag) { this(word); WordTag wT = new WordTag(word, tag); this.lemma = Morphology.stemStatic(wT).word(); setTag(tag.value()); }
/** * Create a new {@code WordLemmaTag}. * * @param word This word is passed to the supertype constructor * @param lemma The lemma is set as the lemma of this Label * @param tag The {@code value()} of this Label is set as the tag of this Label */ public WordLemmaTag(String word, String lemma, String tag) { this(word); this.lemma = lemma; setTag(tag); }
/** * Create a new {@code WordLemmaTag}. * * @param word This word is set as the word of this Label * @param tag The {@code value()} of this Label is set as the tag of this Label */ public WordLemmaTag(String word, String tag) { WordTag wT = new WordTag(word, tag); this.word = word; this.lemma = Morphology.stemStatic(wT).word(); setTag(tag); }
public WordLemmaTag(String word) { this.word = word; this.lemma = null; setTag(null); }