Example #1
0
 /**
  * Orders first by word, then by lemma, then by tag.
  *
  * @param wordLemmaTag object to compare to
  * @return result (positive if {@code this} is greater than {@code obj}, 0 if equal, negative
  *     otherwise)
  */
 @Override
 public int compareTo(WordLemmaTag wordLemmaTag) {
   int first = word().compareTo(wordLemmaTag.word());
   if (first != 0) return first;
   int second = lemma().compareTo(wordLemmaTag.lemma());
   if (second != 0) return second;
   else return tag().compareTo(wordLemmaTag.tag());
 }
Example #2
0
  /**
   * Equality is satisfied only if the compared object is a WordLemmaTag and has String-equal word,
   * lemma and tag fields.
   */
  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (!(o instanceof WordLemmaTag)) return false;

    final WordLemmaTag other = (WordLemmaTag) o;
    return word().equals(other.word())
        && lemma().equals(other.lemma())
        && tag().equals(other.tag());
  }
Example #3
0
  /*for debugging only*/
  public static void main(String[] args) {
    WordLemmaTag wLT = new WordLemmaTag();
    wLT.setFromString("hunter/NN");

    System.out.println(wLT.word());
    System.out.println(wLT.lemma());
    System.out.println(wLT.tag());

    WordLemmaTag wLT2 = new WordLemmaTag();
    wLT2.setFromString("bought/buy/V");
    System.out.println(wLT2.word());
    System.out.println(wLT2.lemma());
    System.out.println(wLT2.tag());

    WordLemmaTag wLT3 = new WordLemmaTag();
    wLT2.setFromString("life");
    System.out.println(wLT3.word());
    System.out.println(wLT3.lemma());
    System.out.println(wLT3.tag());
  }