Code Search for Developers
 
 
  

WordFormConstruction.java from Texai at Krugle


Show WordFormConstruction.java syntax highlighted

/*
 * WordFormConstruction.java
 *
 * Created on January 6, 2007, 6:13 PM
 *
 * Description: Provides a word form construction 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.grammar.domainEntity;

import net.jcip.annotations.NotThreadSafe;
import org.openrdf.model.URI;
import org.texai.grammar.understanding.ActiveConstituent;
import org.texai.grammar.understanding.ActiveWordFormConstruction;
import org.texai.kb.Constants;
import org.texai.kb.persistence.RDFEntity;
import org.texai.kb.persistence.RDFNamespace;
import org.texai.kb.persistence.RDFProperty;
import org.texai.lexicon.domainEntity.TexaiEnglishWordForm;


/** Provides a word form construction entity.
 *
 * @author reed
 */
@RDFEntity(
namespaces={
  @RDFNamespace(prefix="texai", namespaceURI=Constants.TEXAI_NAMESPACE),
  @RDFNamespace(prefix="cyc", namespaceURI=Constants.CYC_NAMESPACE)},
subject="texai:org.texai.grammar.domainEntity.WordFormConstruction", type="cyc:LinguisticObjectType", subClassOf="texai:CxgConstruction", context="texai:EnglishConstructionGrammarDomainContext")
@NotThreadSafe  // but effectively immutable
public class WordFormConstruction extends AbstractConstruction {
  
  
  /** the lexicon English word */
  @RDFProperty(predicate="texai:texaiEnglishWordForm")
  private TexaiEnglishWordForm texaiEnglishWordForm;
  
  /**
   * Creates a new instance of WordFormConstruction.
   */
  public WordFormConstruction() {
    super();
  }
  
  /**
   * Creates a new instance of WordFormConstruction.
   * 
   * @param name the construction name that identifies this instance
   * @param naturalLanguage the natural language to which this construction applies
   * @param texaiEnglishWordForm the lexicon English word form
   */
  public WordFormConstruction(
          final URI naturalLanguage, 
          final TexaiEnglishWordForm texaiEnglishWordForm) {
    super(texaiEnglishWordForm.getWordForm(), naturalLanguage);
    //Preconditions
    assert texaiEnglishWordForm != null : "texaiEnglishWordForm must not be null";
    
    this.texaiEnglishWordForm = texaiEnglishWordForm;
  }
  
  /** Gets the lexicon English word form.
   *
   * @return the lexicon English word form
   */
  public TexaiEnglishWordForm getTexaiEnglishWordForm() {
    return texaiEnglishWordForm;
  }
  
 /** Decorates this construction with an active construction that contains the 
   * behavior and transient state for parsing text.
   *
   * @return an WordFormConstruction that decorates this object
   */
  public ActiveConstituent decorate() {
    return new ActiveWordFormConstruction(this);
  }
  
  /** Returns a hash code for this object.
   *
   * @return a hash code for this object
   */
  @Override
  public int hashCode() {
    if (getId() == null) {
      return super.hashCode();
    } else {
      return getId().hashCode();
    }
  }
  
  /** Returns whether the given object is equal to this object.
   *
   * @param obj the given object
   * @return whether the given object is equal to this object
   */
  @Override
  public boolean equals(final Object obj) {
    if (obj instanceof WordFormConstruction) {
      final WordFormConstruction that = (WordFormConstruction) obj;
      return this.getId().equals(that.getId());
    } else {
      return false;
    } 
  }
  
}




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

  AbstractComposedConstruction.java
  AbstractConstruction.java
  AlternativeConstruction.java
  CategoryConstruction.java
  ConstituentAdapter.java
  OptionalConstruction.java
  RegularExpression.java
  RegularExpression_GroupVariableInfo.java
  RepetitiveConstruction.java
  SequenceConstruction.java
  SimpleConstruction.java
  ValidateGrammarEntities.java
  WordFormConstruction.java
  WordSenseConstruction.java
  XMLTagWord.java