ch.uzh.ifi.attempto.base
Class DefaultTextOperator

java.lang.Object
  extended by ch.uzh.ifi.attempto.base.DefaultTextOperator
All Implemented Interfaces:
TextOperator
Direct Known Subclasses:
ACETextOperator

public class DefaultTextOperator
extends java.lang.Object
implements TextOperator

This class is the default implementation of a text operator.

Author:
Tobias Kuhn

Constructor Summary
DefaultTextOperator()
           
 
Method Summary
 TextElement createTextElement(java.lang.String text)
          This method should create a text element for the given text.
 java.lang.String getGlue(TextElement left, TextElement right)
          This method should return the "glue" to connect two text elements.
 java.lang.String getTextInContext(TextElement textElement, java.lang.String preceding, java.lang.String following)
          This method checks the context of a text element and can do small surface adaptations of a token according to the surrounding text.
 java.util.List<java.lang.String> splitIntoTokens(java.lang.String text)
          This method should split a text into its tokens.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultTextOperator

public DefaultTextOperator()
Method Detail

createTextElement

public TextElement createTextElement(java.lang.String text)
Description copied from interface: TextOperator
This method should create a text element for the given text.

Specified by:
createTextElement in interface TextOperator
Parameters:
text - The text.
Returns:
The text element.

getTextInContext

public java.lang.String getTextInContext(TextElement textElement,
                                         java.lang.String preceding,
                                         java.lang.String following)
Description copied from interface: TextOperator
This method checks the context of a text element and can do small surface adaptations of a token according to the surrounding text. E.g. in English "a" should become "an" in front of "apple".

Specified by:
getTextInContext in interface TextOperator
Parameters:
textElement - The text element whose text should be adapted to the context.
preceding - The preceding text.
following - The following text.
Returns:
The adapted text.

splitIntoTokens

public java.util.List<java.lang.String> splitIntoTokens(java.lang.String text)
Description copied from interface: TextOperator
This method should split a text into its tokens.

Specified by:
splitIntoTokens in interface TextOperator
Parameters:
text - The input text.
Returns:
A list of strings representing the tokens.

getGlue

public java.lang.String getGlue(TextElement left,
                                TextElement right)
Description copied from interface: TextOperator
This method should return the "glue" to connect two text elements. Mostly, this should be a single blank space or the empty string.

Specified by:
getGlue in interface TextOperator
Parameters:
left - The left-hand side text element.
right - The right-hand side text element.
Returns:
The glue string.


Copyright 2008-2012, AceWiki developers