ch.uzh.ifi.attempto.preditor.text
Class BasicTextElement

java.lang.Object
  extended by ch.uzh.ifi.attempto.preditor.text.BasicTextElement
All Implemented Interfaces:
TextElement
Direct Known Subclasses:
NounTextElement, VarTextElement

public class BasicTextElement
extends java.lang.Object
implements TextElement

This is a general purpose implementation of a text element.

Author:
Tobias Kuhn

Constructor Summary
BasicTextElement(int number)
          Creates a new basic text element containing a number which is also the name of the category.
BasicTextElement(int number, java.lang.String categoryName)
          Creates a new basic text element containing a number.
BasicTextElement(int number, Terminal category)
          Creates a new basic text element containing a number.
BasicTextElement(java.lang.String categoryName)
          Creates a new basic text element where the text is the name of the category.
BasicTextElement(java.lang.String categoryName, boolean capitalize)
          Creates a new basic text element where the text is the name of the category.
BasicTextElement(java.lang.String text, java.lang.String categoryName)
          Creates a new basic text element.
BasicTextElement(java.lang.String text, java.lang.String categoryName, boolean capitalize)
          Creates a new basic text element.
BasicTextElement(java.lang.String text, Terminal category)
          Creates a new basic text element.
BasicTextElement(java.lang.String text, Terminal category, boolean capitalize)
          Creates a new basic text element.
BasicTextElement(Terminal category)
          Creates a new basic text element where the text is the name of the category.
BasicTextElement(Terminal category, boolean capitalize)
          Creates a new basic text element where the text is the name of the category.
 
Method Summary
 void checkNeighborTextElements(TextElement precedingTextElement, TextElement nextTextElement)
          Checks the preceding and next text element.
 boolean equals(java.lang.Object obj)
           
 Terminal getCategory()
          Returns the grammatical category of this text element.
 java.lang.String getText()
          Returns the text of this text element.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicTextElement

public BasicTextElement(java.lang.String text,
                        Terminal category,
                        boolean capitalize)
Creates a new basic text element.

Parameters:
text - The text.
category - The category.
capitalize - true if the word should be capitalized in sentence-initial position.

BasicTextElement

public BasicTextElement(java.lang.String text,
                        java.lang.String categoryName,
                        boolean capitalize)
Creates a new basic text element.

Parameters:
text - The text.
categoryName - The name of the category.
capitalize - true if the word should be capitalized in sentence-initial position.

BasicTextElement

public BasicTextElement(java.lang.String text,
                        Terminal category)
Creates a new basic text element. It is capitalized in sentence-initial position.

Parameters:
text - The text.
category - The category.

BasicTextElement

public BasicTextElement(java.lang.String text,
                        java.lang.String categoryName)
Creates a new basic text element. It is capitalized in sentence-initial position.

Parameters:
text - The text.
categoryName - The name of the category.

BasicTextElement

public BasicTextElement(int number,
                        Terminal category)
Creates a new basic text element containing a number. The text element is capitalized in sentence-initial position.

Parameters:
number - The number.
category - The category.

BasicTextElement

public BasicTextElement(int number,
                        java.lang.String categoryName)
Creates a new basic text element containing a number. The text element is capitalized in sentence-initial position.

Parameters:
number - The number.
categoryName - The name of the category.

BasicTextElement

public BasicTextElement(Terminal category,
                        boolean capitalize)
Creates a new basic text element where the text is the name of the category.

Parameters:
category - The category.
capitalize - true if the word should be capitalized in sentence-initial position.

BasicTextElement

public BasicTextElement(java.lang.String categoryName,
                        boolean capitalize)
Creates a new basic text element where the text is the name of the category.

Parameters:
categoryName - The name of the category.
capitalize - true if the word should be capitalized in sentence-initial position.

BasicTextElement

public BasicTextElement(Terminal category)
Creates a new basic text element where the text is the name of the category. The text element is capitalized in sentence-initial position.

Parameters:
category - The category.

BasicTextElement

public BasicTextElement(java.lang.String categoryName)
Creates a new basic text element where the text is the name of the category. The text element is capitalized in sentence-initial position.

Parameters:
categoryName - The name of the category.

BasicTextElement

public BasicTextElement(int number)
Creates a new basic text element containing a number which is also the name of the category. The text element is capitalized in sentence-initial position.

Parameters:
number - The number.
Method Detail

getCategory

public Terminal getCategory()
Description copied from interface: TextElement
Returns the grammatical category of this text element.

Specified by:
getCategory in interface TextElement
Returns:
The grammatical category.

getText

public java.lang.String getText()
Description copied from interface: TextElement
Returns the text of this text element.

Specified by:
getText in interface TextElement
Returns:
The text.

checkNeighborTextElements

public void checkNeighborTextElements(TextElement precedingTextElement,
                                      TextElement nextTextElement)
Description copied from interface: TextElement
Checks the preceding and next text element. This is needed for words that change their form depending on the context, e.g. for capitalization or for the indefinite article "a"/"an".

Specified by:
checkNeighborTextElements in interface TextElement

equals

public boolean equals(java.lang.Object obj)
Specified by:
equals in interface TextElement
Overrides:
equals in class java.lang.Object


Copyright 2008-2009, Attempto Group, University of Zurich (see http://attempto.ifi.uzh.ch)