|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectch.uzh.ifi.attempto.preditor.text.EnglishContextChecker
public class EnglishContextChecker
This is a simple implementation of a context checker for the English language. The words "a" and "an" are adapted accoring to the following word, e.g. "a","apple" becomes "an","apple", and "an", "customer" becomes "a","customer". Furthermore, words can be capitalized if they are at sentence- initial position. Capitalization can be turned on or off. In both cases exceptions can be defined using the feature "capitalize" that is read from the category of the text element. If exceptions are enabled and the value of "capitalize" is "true" or "false" then this overrides the default capitalization behavior.
Constructor Summary | |
---|---|
EnglishContextChecker(boolean defaultCapitalize)
Creates a new English context checker with no exceptions for capitalization. |
|
EnglishContextChecker(boolean defaultCapitalize,
boolean exceptionsEnabled)
Creates a new English context checker. |
Method Summary | |
---|---|
boolean |
areExceptionsEnabled()
Returns whether capitalization exceptions are enabled. |
java.lang.String |
getTextInContext(TextElement textElement,
java.lang.String precedingText,
java.lang.String followingText)
This method should return the adapted text of the text element if it occurs between the given tokens. |
boolean |
isDefaultCapitalize()
Returns whether words are capitalized by default. |
void |
setDefaultCapitalize(boolean defaultCapitalize)
Enables or disables the default capitalization. |
void |
setExceptionsEnabled(boolean exceptionsEnabled)
Enables or disables capitalization exceptions. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EnglishContextChecker(boolean defaultCapitalize, boolean exceptionsEnabled)
defaultCapitalize
- true if words should be capitalized by default.exceptionsEnabled
- true if exceptions can be defined using the feature "capitalize".public EnglishContextChecker(boolean defaultCapitalize)
defaultCapitalize
- true if words should be capitalized by default.Method Detail |
---|
public boolean isDefaultCapitalize()
public void setDefaultCapitalize(boolean defaultCapitalize)
defaultCapitalize
- true if words should be capitalized by default.public boolean areExceptionsEnabled()
public void setExceptionsEnabled(boolean exceptionsEnabled)
exceptionsEnabled
- true if exceptions the feature "capitalize" should be used to define
capitalization exceptions.public java.lang.String getTextInContext(TextElement textElement, java.lang.String precedingText, java.lang.String followingText)
ContextChecker
getTextInContext
in interface ContextChecker
textElement
- The text element whose text should be adapted to the context.precedingText
- The preceding token.followingText
- The following token.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |