Пример #1
0
  /**
   * Gets the lemma of a word.
   *
   * @param word a word
   * @param pos part of speech
   * @return lemma or the input if it could not be lemmatized
   */
  public static String getLemma(String word, POS pos) {
    if (wDict == null) {
      return word;
    }
    IndexWord indexWord = null;

    try {
      indexWord = wDict.lookupIndexWord(pos, word);
    } catch (JWNLException e) {
    }

    return (indexWord != null) ? indexWord.getLemma() : word;
  }
Пример #2
0
  @Override
  public String toString() {
    StringBuilder out = new StringBuilder("");
    out.append("Schema ---\n");
    out.append("Word Count: ").append(words.size()).append("\n");
    for (String s : words) {
      out.append(s).append(" ");
    }
    out.append("\n");
    for (IndexWord w : indexes) {
      out.append(w.getLemma()).append(":").append(w.getPOS().getLabel()).append(" ");
    }
    out.append("\n");

    return out.toString();
  }