Пример #1
0
  public List<String> getDerivation(String concept1, String concept2) {
    List<String> derivation = new ArrayList<String>();

    Synset[] synsets = database.getSynsets(concept1);
    for (Synset synset : synsets) {
      for (WordSense wordsense : synset.getDerivationallyRelatedForms(concept2))
        derivation.add(wordsense.getWordForm());
    }

    return derivation;
  }
  /**
   * get derivationally form
   *
   * @param lemma
   * @param type
   * @return
   */
  public Set<String> getDerivationallyRelatedForms(String lemma, SynsetType type) {
    Set<String> derivationallyForm = new HashSet<String>();
    Synset[] synsets = wordnet.getSynsets(lemma, type);
    for (Synset synset : synsets) {
      WordSense[] senses = synset.getDerivationallyRelatedForms(lemma);
      for (WordSense sense : senses) {
        derivationallyForm.add(sense.getWordForm());
      }
    }

    return derivationallyForm;
  }