Code Search for Developers
 
 
  

WordNetSynset.java from Texai at Krugle


Show WordNetSynset.java syntax highlighted

/*
 * WordNetSynset.java
 *
 * Created on November 7, 2006, 2:56 PM
 *
 * Description: WordNet synset RDF entity.
 *
 * Copyright (C) 2006 Stephen L. Reed.
 *
 * This program is free software; you can redistribute it and/or modify it under the terms
 * of the GNU General Public License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with this program;
 * if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

package org.texai.wordnet.domain.entity;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import javax.persistence.Id;
import net.jcip.annotations.NotThreadSafe;
import org.openrdf.model.URI;
import org.texai.kb.Constants;
import org.texai.kb.persistence.RDFEntity;
import org.texai.kb.persistence.RDFNamespace;
import org.texai.kb.persistence.RDFProperty;

/** WordNet synset RDF entity.  This class is not technically thread safe, but client applications should
 * treat it as immutable once loaded.  The field setter methods should not be used nor should the field
 * contents be modified.
 * 
 * @author reed
 */
@RDFEntity(
namespaces={
  @RDFNamespace(prefix="texai", namespaceURI=Constants.TEXAI_NAMESPACE),
  @RDFNamespace(prefix="cyc", namespaceURI=Constants.CYC_NAMESPACE)},
subject="cyc:WordNetSynset", context=Constants.TERM_WORDNET21_DOMAIN_CONTEXT)
@NotThreadSafe  // but effectively immutable
public class WordNetSynset {   // NOPMD

  /** the range designation WordNetSynset */
  private static final String WORD_NET_SYNSET = "cyc:WordNetSynset";
  
  /** the id assigned by the persistence framework */
  @Id
  private URI id;                                          // NOPMD
  
  /** the mapped terms */
  @RDFProperty(predicate="texai:wnMappedTerm")
  private Set<URI> wnMappedTerms;
  
  /** the synonym set id */
  @RDFProperty(predicate="texai:wnWordNetSynsetId")
  private long wnWordNetSynsetId;                     

  /** the part of speech */
  @RDFProperty(predicate="cyc:wnSynsetSpeechPart")
  private URI wnSynsetSpeechPart;                 
  
  /** the WordNet category */
  @RDFProperty(predicate="texai:wnCategory", subPropertyOf="cyc:genls")
  private WordNetCategory wnCategory;                     

  /** the concept definition */
  @RDFProperty(predicate="cyc:wnSynsetGloss")
  private String wnSynsetGloss;                           
  
  /** the word senses */
  @RDFProperty(predicate="texai:wnWordSenseSynset", domain="cyc:WordNetWordSense", inverse=true)
  private Set<WordNetWordSense> wnSynsetWordSenses;       
  
  /** the sample phrase items */
  @RDFProperty(predicate="texai:wnSynsetSamplePhraseItem", range="texai:org.texai.wordnet.domain.entity.WordNetSamplePhraseItem")
  private Set<WordNetSamplePhraseItem> wnSynsetSamplePhraseItems;    
  
  /** the hypernyms */
  @RDFProperty(predicate="cyc:wnHypernym", range=WORD_NET_SYNSET)
  private Set<WordNetSynset> wnHypernyms;                  
  
  /** the hyponyms */
  @RDFProperty(predicate="texai:wnHyponym", range=WORD_NET_SYNSET)
  private Set<WordNetSynset> wnHyponyms;                   
  
  /** the instance hypernyms */
  @RDFProperty(predicate="texai:wnInstanceHypernym", range=WORD_NET_SYNSET)
  private Set<WordNetSynset> wnInstanceHypernyms;         
  
  /** the instance hyponyms */
  @RDFProperty(predicate="texai:wnInstanceHyponym", range=WORD_NET_SYNSET)
  private Set<WordNetSynset> wnInstanceHyponyms;          
  
  /** the part holonyms */
  @RDFProperty(predicate="cyc:wnPartHolonym", range=WORD_NET_SYNSET)
  private Set<WordNetSynset> wnPartHolonyms;              
  
  /** the part meronyms */
  @RDFProperty(predicate="texai:wnPartMeronym", range=WORD_NET_SYNSET)
  private Set<WordNetSynset> wnPartMeronyms;               
  
  /** the member holonyms */
  @RDFProperty(predicate="texai:wnMemberHolonym", range=WORD_NET_SYNSET)
  private Set<WordNetSynset> wnMemberHolonyms;           
  
  /** the member meronyms */
  @RDFProperty(predicate="texai:wnMemberMeronym", range=WORD_NET_SYNSET)
  private Set<WordNetSynset> wnMemberMeronyms;            
  
  /** the substance holoynyms */
  @RDFProperty(predicate="cyc:wnSubstanceHolonym", range=WORD_NET_SYNSET)
  private Set<WordNetSynset> wnSubstanceHolonyms;          
  
  /** the substance meronyms */
  @RDFProperty(predicate="texai:wnSubstanceMeronym", range=WORD_NET_SYNSET)
  private Set<WordNetSynset> wnSubstanceMeronyms;         
  
  /** the entailments */
  @RDFProperty(predicate="cyc:wnEntailment", range=WORD_NET_SYNSET)
  private Set<WordNetSynset> wnEntailments;                
  
  /** the causes */
  @RDFProperty(predicate="cyc:wnCause", range=WORD_NET_SYNSET)
  private Set<WordNetSynset> wnCauses;                     
  
  /** the antonyms */
  @RDFProperty(predicate="cyc:wnAntonym", range=WORD_NET_SYNSET)
  private Set<WordNetSynset> wnAntonyms;                   // NOPMD
  
  /** the similar-tos */
  @RDFProperty(predicate="cyc:wnSimilarTo", range=WORD_NET_SYNSET)
  private Set<WordNetSynset> wnSimilarTos;                 
  
  /** the also-sees */
  @RDFProperty(predicate="cyc:wnAlsoSee", range=WORD_NET_SYNSET)
  private Set<WordNetSynset> wnAlsoSees;                   
  
  /** the attributes */
  @RDFProperty(predicate="cyc:wnAttribute", range=WORD_NET_SYNSET)
  private Set<WordNetSynset> wnAttributes;                
  
  /** the verb groups */
  @RDFProperty(predicate="cyc:wnVerbGroup", range=WORD_NET_SYNSET)
  private Set<WordNetSynset> wnVerbGroups;                 
  
  /** the domain categories */
  @RDFProperty(predicate="cyc:wnCategoryDomain", range=WORD_NET_SYNSET)
  private Set<WordNetSynset> wnCategoryDomains;           
  
  /** the domain member categories */
  @RDFProperty(predicate="texai:wnCategoryDomainMember", range=WORD_NET_SYNSET)
  private Set<WordNetSynset> wnCategoryDomainMembers;      
  
  /** the domain regions */
  @RDFProperty(predicate="cyc:wnRegionDomain", range=WORD_NET_SYNSET)
  private Set<WordNetSynset> wnRegionDomains;              
  
  /** the domain member regions */
  @RDFProperty(predicate="texai:wnRegionDomainMember", range=WORD_NET_SYNSET)
  private Set<WordNetSynset> wnRegionDomainMembers;        
  
  /** the domain usages */
  @RDFProperty(predicate="cyc:wnUsageDomain", range=WORD_NET_SYNSET)
  private Set<WordNetSynset> wnUsageDomains;              
  
  /** the domain member usages */
  @RDFProperty(predicate="texai:wnUsageDomainMember", range=WORD_NET_SYNSET)
  private Set<WordNetSynset> wnUsageDomainMembers;         
  
  /** the domains */
  @RDFProperty(predicate="texai:wnDomain", range=WORD_NET_SYNSET)
  private Set<WordNetSynset> wnDomains;                    
  
  /** the members */
  @RDFProperty(predicate="texai:wnMember", range=WORD_NET_SYNSET)
  private Set<WordNetSynset> wnMembers;                    
  
  /**
   * Creates a new instance of WordNetSynset
   */
  public WordNetSynset() {
    super();
  }

  /** Creates a new instance of WordNetSynset with the specified values.
   * 
   * @param wnWordNetSynsetId the synonym set id
   * @param wnSynsetSpeechPart the part of speech
   * @param wnCategory the category
   * @param wnSynsetGloss the concept definition
   */
  public WordNetSynset(
          final long wnWordNetSynsetId, 
          final URI wnSynsetSpeechPart,
          final WordNetCategory wnCategory,
          final String wnSynsetGloss) {
    super();
    //Preconditions
    assert wnWordNetSynsetId > 0 : "wnWordNetSynset must be positivel";
    assert wnSynsetSpeechPart != null : "wnSynsetSpeechPart must not be null";
    assert wnCategory != null : "wnCategory must not be null";
    assert wnSynsetGloss != null : "wnSynsetGloss must not be null";    
    assert wnSynsetGloss.length() > 0 : "wnSynsetGloss must not be an empty string";    

    this.wnWordNetSynsetId = wnWordNetSynsetId;
    this.wnSynsetSpeechPart = wnSynsetSpeechPart;
    this.wnCategory = wnCategory;
    this.wnSynsetGloss = wnSynsetGloss;
  }

  /** Returns a hash code value for the object.
   *
   * @return a hash code value for this object.
   */
  @Override
  public int hashCode() {
    return getId().hashCode();
  }

  /** Determines whether another object is equal to this WordNetSynset.
   * 
   * @param object the reference object with which to compare
   * @return <code>true</code> if this object is the same as the argument;
   * <code>false</code> otherwise.
   */
  @Override
  public boolean equals(final Object object) {
    if (!(object instanceof WordNetSynset)) {
      return false;
    }
    final WordNetSynset that = (WordNetSynset) object;
    return this.getId().equals(that.getId());
  }

  /** Gets the synsetid of this WordNetSynset.
   * 
   * @return the synset id
   */
  public long getWNWordNetSynsetId() {
    return wnWordNetSynsetId;
  }

  /** Gets the mapped term.
   * 
   * @return the mapped term
   */
  public Set<URI> getWNMappedTerms() {
    return wnMappedTerms;
  }

  /** Sets the mapped term.
   *
   * @param wnMappedTerm the mapped term
   */
  public void setWNMappedTerms(final Set<URI> wnMappedTerms) {
    this.wnMappedTerms = wnMappedTerms;
  }

  /** Gets the part of speech.
   * 
   * @return the part of speech
   */
  public URI getWNSynsetSpeechPart() {
    return wnSynsetSpeechPart;
  }

  /** Gets the category of this WordNetSynset.
   * 
   * @return the category
   */
  public WordNetCategory getWNCategory() {
    return wnCategory;
  }

  /** Gets the definition of this WordNetSynset.
   * 
   * @return the definition
   */
  public String getWNSynsetGloss() {
    return wnSynsetGloss;
  }

  /** Returns a string representation of the object.
   *
   * @return a string representation of the object.
   */
  @Override
  public String toString() {
    if (wnSynsetSpeechPart == null) {
      return "[partially initialized synset " + wnWordNetSynsetId + "]";
    } else {
      return "[" + wnSynsetSpeechPart + " synset " + wnWordNetSynsetId + "]";
    }
  }

  /** Gets the id.
   *
   * @return the id
   */
  public URI getId() {
    return id;
  }
  
  /** Gets the word senses.
   *
   * @return the word senses
   */
  public Set<WordNetWordSense> getWNWordSenses() {
    return wnSynsetWordSenses;
  }

  /** Sets the word senses.
   *
   * @param wnSynsetWordSenses the word senses
   */
  public void setWNWordSenses(final Set<WordNetWordSense> wnSynsetWordSenses) {
    //Preconditions
    assert wnSynsetWordSenses != null : "wnSynsetWordSenses must not be null";
    
    this.wnSynsetWordSenses = wnSynsetWordSenses;
  }

  /** Gets the sample phrase items.
   *
   * @return the sample phrase items
   */
  public Set<WordNetSamplePhraseItem> getWNSynsetSamplePhraseItems() {
    return wnSynsetSamplePhraseItems;
  }

  /** Sets the sample phrase items.
   *
   * @param wnSynsetSamplePhraseItems the sample phrase items
   */
  public void setWNSynsetSamplePhraseItems(final Set<WordNetSamplePhraseItem> wnSynsetSamplePhraseItems) {
    //Preconditions
    assert wnSynsetSamplePhraseItems != null : "wnSynsetSamplePhraseItems must not be null";
    
    this.wnSynsetSamplePhraseItems = wnSynsetSamplePhraseItems;
  }

  /** Gets the instance wnSynsetWordSenses.
   *
   * @return the instance hypernyms
   */
  public Set<WordNetSynset> getWNHypernyms() {
    return wnHypernyms;
  }

  /** Sets the instance hypernyms.
   *
   * @param wnHypernyms the instance hypernyms
   */
  public void setWNHypernyms(final Set<WordNetSynset> wnHypernyms) {
    //Preconditions
    assert wnHypernyms != null : "wnHypernyms must not be null";
    
    this.wnHypernyms = wnHypernyms;
  }

  /** Gets the hyponyms.
   *
   * @return the hyponyms
   */
  public Set<WordNetSynset> getWNHyponyms() {
    return wnHyponyms;
  }

  /** Sets the hyponyms.
   *
   * @param wnHyponym the hyponyms
   */
  public void setWNHyponyms(final Set<WordNetSynset> wnHyponyms) {
    //Preconditions
    assert wnHyponyms != null : "wnHyponyms must not be null";
    
    this.wnHyponyms = wnHyponyms;
  }

  /** Gets the instance hypernyms.
   *
   * @return the instance hypernyms
   */
  public Set<WordNetSynset> getWNInstanceHypernyms() {
    return wnInstanceHypernyms;
  }

  /** Sets the instance hypernyms.
   *
   * @param wnInstanceHypernyms the instance hypernyms
   */
  public void setWNInstanceHypernyms(final Set<WordNetSynset> wnInstanceHypernyms) {
    //Preconditions
    assert wnInstanceHypernyms != null : "wnInstanceHypernyms must not be null";
    
    this.wnInstanceHypernyms = wnInstanceHypernyms;
  }

  /** Gets the instance hyponyms.
   *
   * @return the instance hyponyms
   */
  public Set<WordNetSynset> getWNInstanceHyponyms() {
    return wnInstanceHyponyms;
  }

  /** Sets the instance hyponyms.
   *
   * @param wnInstanceHyponyms the instance hyponyms
   */
  public void setWNInstanceHyponyms(final Set<WordNetSynset> wnInstanceHyponyms) {
    //Preconditions
    assert wnInstanceHyponyms != null : "wnInstanceHyponyms must not be null";
    
    this.wnInstanceHyponyms = wnInstanceHyponyms;
  }

  /** Gets the part holonyms.
   *
   * @return the part holonyms
   */
  public Set<WordNetSynset> getWNPartHolonyms() {
    return wnPartHolonyms;
  }

  /** Sets the part holonyms.
   *
   * @param wnPartHolonyms the part holonyms
   */
  public void setWNPartHolonyms(final Set<WordNetSynset> wnPartHolonyms) {
    //Preconditions
    assert wnPartHolonyms != null : "wnPartHolonyms must not be null";
    
    this.wnPartHolonyms = wnPartHolonyms;
  }

  /** Gets the part meronyms.
   *
   * @return the part meronyms
   */
  public Set<WordNetSynset> getWNPartMeronyms() {
    return wnPartMeronyms;
  }

  /** Sets the part meronyms.
   *
   * @param wnPartMeronyms the part meronyms
   */
  public void setWNPartMeronyms(final Set<WordNetSynset> wnPartMeronyms) {
    //Preconditions
    assert wnPartMeronyms != null : "wnPartMeronyms must not be null";
    
    this.wnPartMeronyms = wnPartMeronyms;
  }

  /** Gets the member holonyms.
   *
   * @return the member holonyms
   */
  public Set<WordNetSynset> getWNMemberHolonyms() {
    return wnMemberHolonyms;
  }

  /** Sets the member holonyms.
   *
   * @param wnMemberHolonyms the member holonyms
   */
  public void setWNMemberHolonyms(final Set<WordNetSynset> wnMemberHolonyms) {
    //Preconditions
    assert wnMemberHolonyms != null : "wnMemberHolonyms must not be null";
    
    this.wnMemberHolonyms = wnMemberHolonyms;
  }

  /** Gets the member meronyms.
   *
   * @return the member meronyms
   */
  public Set<WordNetSynset> getWNMemberMeronyms() {
    return wnMemberMeronyms;
  }

  /** Sets the member meronyms.
   *
   * @param wnMemberMeronyms the member meronyms
   */
  public void setWNMemberMeronyms(final Set<WordNetSynset> wnMemberMeronyms) {
    //Preconditions
    assert wnMemberMeronyms != null : "wnMemberMeronyms must not be null";
    
    this.wnMemberMeronyms = wnMemberMeronyms;
  }

  /** Gets the substance holoynyms.
   *
   * @return the substance holoynyms
   */
  public Set<WordNetSynset> getWNSubstanceHolonyms() {
    return wnSubstanceHolonyms;
  }

  /** Sets the substance holoynyms.
   *
   * @param wnSubstanceHolonyms the substance holoynyms
   */
  public void setWNSubstanceHolonyms(final Set<WordNetSynset> wnSubstanceHolonyms) {
    //Preconditions
    assert wnSubstanceHolonyms != null : "wnSubstanceHolonyms must not be null";
    
    this.wnSubstanceHolonyms = wnSubstanceHolonyms;
  }

  /** Gets the substance meronyms.
   *
   * @return the substance meronyms
   */
  public Set<WordNetSynset> getWNSubstanceMeronyms() {
    return wnSubstanceMeronyms;
  }

  /** Sets the substance meronyms.
   *
   * @param wnSubstanceMeronyms the substance meronyms
   */
  public void setWNSubstanceMeronyms(final Set<WordNetSynset> wnSubstanceMeronyms) {
    //Preconditions
    assert wnSubstanceMeronyms != null : "wnSubstanceMeronyms must not be null";
    
    this.wnSubstanceMeronyms = wnSubstanceMeronyms;
  }

  /** Gets the entailments.
   *
   * @return the entailments
   */
  public Set<WordNetSynset> getWNEntailments() {
    return wnEntailments;
  }

  /** Sets the entailments.
   *
   * @param wnEntailments the entailments
   */
  public void setWNEntailments(final Set<WordNetSynset> wnEntailments) {
    //Preconditions
    assert wnEntailments != null : "wnEntailments must not be null";
    
    this.wnEntailments = wnEntailments;
  }

  /** Gets the causes.
   *
   * @return the causes
   */
  public Set<WordNetSynset> getWNCauses() {
    return wnCauses;
  }

  /** Sets the causes.
   *
   * @param wnCauses the causes
   */
  public void setWNCauses(final Set<WordNetSynset> wnCauses) {
    //Preconditions
    assert wnCauses != null : "wnCauses must not be null";
    
    this.wnCauses = wnCauses;
  }

  /** Gets the antonyms.
   *
   * @return the antonyms
   */
  public Set<WordNetSynset> getWNAntonyms() {
    return wnAntonyms;
  }

  /** Sets the antonyms.
   *
   * @param wnAntonyms the antonyms 
   */
  public void setWNAntonyms(final Set<WordNetSynset> wnAntonyms) {
    //Preconditions
    assert wnAntonyms != null : "wnAntonyms must not be null";
    
    this.wnAntonyms = wnAntonyms;
  }

  /** Gets the similar-tos.
   *
   * @return the similar-tos
   */
  public Set<WordNetSynset> getWNSimilarTos() {
    return wnSimilarTos;
  }

  /** Sets the similar-tos.
   *
   * @param wnSimilarTos the similar-tos
   */
  public void setWNSimilarTos(final Set<WordNetSynset> wnSimilarTos) {
    //Preconditions
    assert wnSimilarTos != null : "wnSimilarTos must not be null";
    
    this.wnSimilarTos = wnSimilarTos;
  }

  /** Gets the also-sees.
   *
   * @return the also-sees
   */
  public Set<WordNetSynset> getWNAlsoSees() {
    return wnAlsoSees;
  }

  /** Sets the also-sees.
   *
   * @param wnAlsoSees the also-sees
   */
  public void setWNAlsoSees(final Set<WordNetSynset> wnAlsoSees) {
    //Preconditions
    assert wnAlsoSees != null : "wnAlsoSees must not be null";
    
    this.wnAlsoSees = wnAlsoSees;
  }

  /** Gets the attributes.
   *
   * @return the attributes
   */
  public Set<WordNetSynset> getWNAttributes() {
    return wnAttributes;
  }

  /** Sets the attributes.
   *
   * @param wnAttributes the attributes
   */
  public void setWNAttributes(final Set<WordNetSynset> wnAttributes) {
    //Preconditions
    assert wnAttributes != null : "wnAttributes must not be null";
    
    this.wnAttributes = wnAttributes;
  }

  /** Gets the verb groups.
   *
   * @return the verb groups
   */
  public Set<WordNetSynset> getWNVerbGroups() {
    return wnVerbGroups;
  }

  /** Sets the verb groups.
   *
   * @param wnVerbGroups the verb groups
   */
  public void setWNVerbGroups(final Set<WordNetSynset> wnVerbGroups) {
    //Preconditions
    assert wnVerbGroups != null : "wnVerbGroups must not be null";
    
    this.wnVerbGroups = wnVerbGroups;
  }

  /** Gets the domain categories.
   *
   * @return the domain categories
   */
  public Set<WordNetSynset> getWNCategoryDomains() {
    return wnCategoryDomains;
  }

  /** Sets domain categories.
   *
   * @param wnCategoryDomains domain categories
   */
  public void setWNCategoryDomains(final Set<WordNetSynset> wnCategoryDomains) {
    //Preconditions
    assert wnCategoryDomains != null : "wnCategoryDomains must not be null";
    
    this.wnCategoryDomains = wnCategoryDomains;
  }

  /** Gets the domain member categories.
   *
   * @return the domain member categories
   */
  public Set<WordNetSynset> getWNCategoryDomainMembers() {
    return wnCategoryDomainMembers;
  }

  /** Sets the domain member categories.
   *
   * @param wnCategoryDomainMembers the domain member categories
   */
  public void setWNCategoryDomainMembers(final Set<WordNetSynset> wnCategoryDomainMembers) {
    //Preconditions
    assert wnCategoryDomainMembers != null : "wnCategoryDomainMembers must not be null";
    
    this.wnCategoryDomainMembers = wnCategoryDomainMembers;
  }

  /** Gets the domain regions.
   *
   * @return the domain regions
   */
  public Set<WordNetSynset> getWNRegionDomains() {
    return wnRegionDomains;
  }

  /** Sets the domain regions.
   *
   * @param wnRegionDomains the domain regions
   */
  public void setWNRegionDomains(final Set<WordNetSynset> wnRegionDomains) {
    //Preconditions
    assert wnRegionDomains != null : "wnRegionDomains must not be null";
    
    this.wnRegionDomains = wnRegionDomains;
  }

  /** Gets the domain member regions.
   *
   * @return the domain member regions
   */
  public Set<WordNetSynset> getWNRegionDomainMembers() {
    return wnRegionDomainMembers;
  }

  /** Sets the domain member regions.
   *
   * @param wnRegionDomainMembers the domain member regions
   */
  public void setWNRegionDomainMembers(final Set<WordNetSynset> wnRegionDomainMembers) {
    //Preconditions
    assert wnRegionDomainMembers != null : "wnRegionDomainMembers must not be null";
    
    this.wnRegionDomainMembers = wnRegionDomainMembers;
  }

  /** Gets the domain usages.
   *
   * @return the domain usages
   */
  public Set<WordNetSynset> getWNUsageDomains() {
    return wnUsageDomains;
  }

  /** Sets the domain usages.
   *
   * @param wnUsageDomains the domain usages
   */
  public void setWNUsageDomains(final Set<WordNetSynset> wnUsageDomains) {
    //Preconditions
    assert wnUsageDomains != null : "wnUsageDomains must not be null";
    
    this.wnUsageDomains = wnUsageDomains;
  }

  /** Gets the domain member usages.
   *
   * @return the domain member usages
   */
  public Set<WordNetSynset> getWNUsageDomainMembers() {
    return wnUsageDomainMembers;
  }

  /** Sets the domain member usages.
   *
   * @param wnUsageDomainMembers the domain member usages
   */
  public void setWNUsageDomainMembers(final Set<WordNetSynset> wnUsageDomainMembers) {
    //Preconditions
    assert wnUsageDomainMembers != null : "wnUsageDomainMembers must not be null";
    
    this.wnUsageDomainMembers = wnUsageDomainMembers;
  }

  /** Gets the domains.
   *
   * @return the domains
   */
  public Set<WordNetSynset> getWNDomains() {
    return wnDomains;
  }

  /** Sets the domains.
   *
   * @param wnDomains the domains
   */
  public void setWNDomains(final Set<WordNetSynset> wnDomains) {
    //Preconditions
    assert wnDomains != null : "wnDomains must not be null";
    
    this.wnDomains = wnDomains;
  }

  /** Gets the members.
   *
   * @return the members
   */
  public Set<WordNetSynset> getWNMembers() {
    return wnMembers;
  }

  /** Sets the members.
   *
   * @param wnMembers the members
   */
  public void setWNMembers(final Set<WordNetSynset> wnMembers) {
    //Preconditions
    assert wnMembers != null : "wnMembers must not be null";
    
    this.wnMembers = wnMembers;
  }

  /** Returns a list of the synset words in string form.
   *
   * @return  a list of the synset words in string form
   */
  public String synsetWordsAsString() {
    final List<String> wordStrings = new ArrayList<String>();
    for (final WordNetWordSense wordNetWordSense : getWNWordSenses()) {
      final WordNetEnglishWord wordNetEnglishWord = wordNetWordSense.getWordNetEnglishWord();
      wordStrings.add(wordNetEnglishWord.getWNLemma());
    }
    return wordStrings.toString();
  }
  
  /** Returns a description of the synset. 
   *
   * @return a description of the synset
   */
  public String description() {
    final StringBuilder stringBuilder = new StringBuilder(Constants.STRING_BUILDER_SIZE);
    stringBuilder.append(synsetWordsAsString());
    stringBuilder.append(' ');
    stringBuilder.append(getWNSynsetSpeechPart().toString().toLowerCase());
    stringBuilder.append(": ");
    stringBuilder.append(getWNSynsetGloss());
    if (!getWNMappedTerms().isEmpty()) {
      stringBuilder.append(" --> ");
      stringBuilder.append(getWNMappedTerms());
    }
    return stringBuilder.toString();
  }
}   // NOPMD




See more files for this project here

Texai

Texai is an chatbot that intelligently seeks to acquire knowledge and friendly behaviors.

Project homepage: http://sourceforge.net/projects/texai
Programming language(s): Java,Shell Script,XML
License: other

  ValidateWordNetEntities.java
  WordNetCasedEnglishWord.java
  WordNetCategory.java
  WordNetEnglishWord.java
  WordNetEnglishWordMorph.java
  WordNetSamplePhraseItem.java
  WordNetSentencePattern.java
  WordNetSynset.java
  WordNetWordSense.java