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 category)
          Creates a new basic text element containing a number.
BasicTextElement(java.lang.String category)
          Creates a new basic text element where the text is the name of the category.
BasicTextElement(java.lang.String category, 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 category)
          Creates a new basic text element.
BasicTextElement(java.lang.String text, java.lang.String category, boolean capitalize)
          Creates a new basic text element.
BasicTextElement(Terminal terminal)
          Creates a new basic text element on the basis of a terminal category object.
BasicTextElement(Terminal terminal, boolean capitalize)
          Creates a new basic text element on the basis of a terminal category object.
 
Method Summary
 void checkNeighborTextElements(TextElement precedingTextElement, TextElement nextTextElement)
          Checks the preceding and next text element.
 boolean equals(java.lang.Object obj)
           
 java.lang.String 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,
                        java.lang.String 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 category)
Creates a new basic text element. It is capitalized in sentence-initial position.

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

BasicTextElement

public BasicTextElement(int number,
                        java.lang.String 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(java.lang.String category,
                        boolean capitalize)
Creates a new basic text element where the text is the name of the category.

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

BasicTextElement

public BasicTextElement(java.lang.String 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 which is the same as the text.

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.

BasicTextElement

public BasicTextElement(Terminal terminal,
                        boolean capitalize)
Creates a new basic text element on the basis of a terminal category object. The text is the same as the category name.

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

BasicTextElement

public BasicTextElement(Terminal terminal)
Creates a new basic text element on the basis of a terminal category object. The text is the same as the category name. The text element is capitalized in sentence-initial position.

Parameters:
terminal - The terminal category object.
Method Detail

getCategory

public java.lang.String 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, Attempto Group, University of Zurich (see http://attempto.ifi.uzh.ch)