Code Search for Developers
 
 
  

WordNetEnglishWordMorph.java from Texai at Krugle


Show WordNetEnglishWordMorph.java syntax highlighted

/*
 * WordNetEnglishWordMorph.java
 *
 * Created on November 16, 2006, 8:34 PM
 *
 * Description: WordNet word spelling variation 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 javax.persistence.Id;
import net.jcip.annotations.NotThreadSafe;
import org.openrdf.model.URI;
import org.texai.kb.Constants;
import org.texai.kb.persistence.RDFProperty;
import org.texai.kb.persistence.RDFEntity;
import org.texai.kb.persistence.RDFNamespace;

/** WordNet word spelling variation 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="texai:org.texai.wordnet.domain.entity.WordNetEnglishWordMorph", type="cyc:LinguisticObjectType", subClassOf="cyc:AbstractInformationStructure", context=Constants.TERM_WORDNET21_DOMAIN_CONTEXT)
@NotThreadSafe  // but effectively immutable
public class WordNetEnglishWordMorph {
  
  /** the id assigned by the persistence framework */
  @Id
  private URI id;                                          // NOPMD
  
  /** the word for which this object is a morphological variation */
  @RDFProperty(predicate="texai:wnWordForMorph")
  private WordNetEnglishWord wnWordForMorph;

  /** the spelling variation */
  @RDFProperty(predicate="texai:wnMorphSpelling")
  private String wnMorphSpelling;                          // NOPMD
    
  /** the part of speech */
  @RDFProperty(predicate="texai:wnMorphSpeechPart")
  private URI wnMorphSpeechPart;                           // NOPMD

  /** the position of this object in the list of spelling variations for the associated English word */
  @RDFProperty(predicate="texai:wnMorphIndex")
  private int wnMorphIndex;                                // NOPMD
  
  /** Creates a new instance of WordNetEnglishWordMorph. */
  public WordNetEnglishWordMorph() {
    super();
  }

  /** Creates a new instance of WordNetEnglishWordMorph. 
   *
   * @param wnWordForMorph the word for which this object is a morphological variation
   * @param wnMorphSpelling the spelling variation
   * @param wnMorphSpeechPart the part of speech
   * @param wnMorphIndex the position of this object in the list of spelling variations for the associated English word
   */
  public WordNetEnglishWordMorph(
          final WordNetEnglishWord wnWordForMorph,
          final String wnMorphSpelling,
          final URI wnMorphSpeechPart,
          final int wnMorphIndex) {
    super();
    //Preconditions
    assert wnWordForMorph != null : "wnWordForMorph must not be null";
    assert wnMorphSpelling != null : "wnMorphSpelling must not be null";
    assert wnMorphSpeechPart != null : "wnMorphSpeechPart must not be null";
    assert wnMorphIndex > 0 : "wnMorphIndex must be positive";
    
    this.wnWordForMorph = wnWordForMorph;
    this.wnMorphSpelling = wnMorphSpelling;
    this.wnMorphSpeechPart = wnMorphSpeechPart;
    this.wnMorphIndex = wnMorphIndex;
  }

  /** 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 WordNetEnglishWordMorph)) {
      return false;
    }
    final WordNetEnglishWordMorph that = (WordNetEnglishWordMorph) object;
    return this.getId().equals(that.getId());
  }

  /** Gets the id.
   *
   * @return the id
   */
  public URI getId() {
    return id;
  }
  
  /** Gets the word for which this object is a morphological variation.
   *
   * @return the word for which this object is a morphological variation
   */
  public WordNetEnglishWord getWnWordForMorph() {
    return wnWordForMorph;
  }

  /** Gets the spelling variation.
   *
   * @return the spelling variation
   */
  public String getWnMorphSpelling() {
    return wnMorphSpelling;
  }

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

  /** Gets the position of this object in the list of spelling variations for the associated English word.
   *
   * @return the position of this object in the list of spelling variations for the associated English word
   */
  public int getWnMorphIndex() {
    return wnMorphIndex;
  }
  
  /** Returns a string representation of this object.
   *
   * @return a string representation of this object
   */
  @Override
  public String toString() {
    return "[" + wnMorphSpelling + "]";
  }
}




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