Esempio n. 1
0
  List keepUniqueTerms(List hypernymsList) {
    ArrayList uniqueList = new ArrayList();
    ArrayList uniqueHypernymList = new ArrayList();
    for (int i = 0; i < hypernymsList.size(); i++) {
      IWord word = (IWord) hypernymsList.get(i);
      if (!uniqueList.contains(word.getLemma().toString())) {
        uniqueList.add(word.getLemma().toString());
        uniqueHypernymList.add(word);
      }
    }

    return uniqueHypernymList;
  }
Esempio n. 2
0
  public boolean areSynoynyms(String word1, String word2) {
    boolean synonyms = false;
    List synoymList = getSynonyms(word1);
    List synoym1List = getSynonyms(word2);
    ArrayList word1List = new ArrayList();
    ArrayList word2List = new ArrayList();
    for (int i = 0; i < synoymList.size(); i++) {
      IWord word = (IWord) synoymList.get(i);
      word1List.add(word.getLemma());
    }

    for (int i = 0; i < synoym1List.size(); i++) {
      IWord word = (IWord) synoym1List.get(i);
      word2List.add(word.getLemma());
    }

    word1List.retainAll(word2List);
    if (word1List.size() > 0) synonyms = true;
    return synonyms;
  }