public class Element
extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
UNKNOWN_TAG
Matches only tokens without any POS tag.
|
| Constructor and Description |
|---|
Element(String token,
boolean caseSensitive,
boolean regExp,
boolean inflected)
Creates Element that is used to match tokens in the text.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addMemberAndGroup(AnalyzedToken token)
Enables testing multiple conditions specified by different elements.
|
boolean |
checkAndGroup(boolean previousValue) |
void |
compile(AnalyzedTokenReadings token,
Synthesizer synth)
Prepare Element for matching by formatting its string token and POS (if the Element is supposed
to refer to some other token).
|
List<Element> |
getAndGroup()
Returns the group of elements linked with AND operator.
|
boolean |
getCaseSensitive()
Whether the element matches case sensitively.
|
List<Element> |
getExceptionList()
Since 1.0.0
|
Match |
getMatch() |
boolean |
getNegation()
|
String |
getPhraseName()
Gets the phrase the element is in.
|
boolean |
getPOSNegation()
Tests whether the POS is negated.
|
String |
getPOStag() |
List<Element> |
getPreviousExceptionList() |
int |
getSkipNext()
Gets the exception scope length.
|
String |
getString() |
Map<String,List<String>> |
getUniFeatures()
Get unification features and types.
|
boolean |
hasAndGroup()
Checks if this element has an AND group associated with it.
|
boolean |
hasExceptionList() |
boolean |
hasNextException()
Checks if the element has an exception for a next scope.
|
boolean |
hasPreviousException()
Checks if the element has an exception for a previous token.
|
boolean |
isAndExceptionGroupMatched(AnalyzedToken token)
Enables testing multiple conditions specified by multiple element exceptions.
|
boolean |
isExceptionMatched(AnalyzedToken token)
Checks whether an exception matches.
|
boolean |
isExceptionMatchedCompletely(AnalyzedToken token)
This method checks exceptions both in AND-group and the token.
|
boolean |
isInflected()
Whether the token is inflected.
|
boolean |
isMatched(AnalyzedToken token)
Checks whether the rule element matches the token given as a parameter.
|
boolean |
isMatchedByPreviousException(AnalyzedToken token)
Checks whether an exception for a previous token matches (in case the exception had scope ==
"previous").
|
boolean |
isMatchedByPreviousException(AnalyzedTokenReadings prevToken)
Checks whether an exception for a previous token matches all readings of a given token (in case
the exception had scope == "previous").
|
boolean |
isMatchedByScopeNextException(AnalyzedToken token)
Checks whether a previously set exception matches (in case the exception had scope == "next").
|
boolean |
isPartOfPhrase()
Checks if the Element is in any phrase.
|
boolean |
isPOStagRegularExpression()
Tests whether the POS matches a regular expression.
|
boolean |
isReferenceElement() |
boolean |
isRegularExpression()
Tests whether the element matches a regular expression.
|
boolean |
isSentStart()
Checks if the token is a SENT_START.
|
boolean |
isUnified() |
boolean |
isUniNegated() |
boolean |
isWhitespaceBefore(AnalyzedToken token) |
void |
setAndGroupElement(Element andToken) |
void |
setExceptionSpaceBefore(boolean isWhite) |
void |
setMatch(Match match)
Sets the reference to another token.
|
void |
setNegation(boolean negation)
Negates the meaning of match().
|
void |
setPhraseName(String s)
Sets the phrase the element is in.
|
void |
setPosElement(String posToken,
boolean regExp,
boolean negation) |
void |
setSkipNext(int i)
Sets the exception scope length.
|
void |
setStringElement(String token) |
void |
setStringPosException(String token,
boolean regExp,
boolean inflected,
boolean negation,
boolean scopeNext,
boolean scopePrevious,
String posToken,
boolean posRegExp,
boolean posNegation)
Sets a string and/or pos exception for matching string tokens.
|
void |
setUnification(Map<String,List<String>> uniFeatures) |
void |
setUniNegation() |
void |
setupAndGroup() |
void |
setWhitespaceBefore(boolean isWhite) |
boolean |
testWhitespace() |
String |
toString() |
public static final String UNKNOWN_TAG
public Element(String token,
boolean caseSensitive,
boolean regExp,
boolean inflected)
token - String to be matchedcaseSensitive - True if the check is case-sensitive.regExp - True if the check uses regular expressions.inflected - True if the check refers to base forms (lemmas).public final boolean isMatched(AnalyzedToken token)
token - public final boolean isExceptionMatched(AnalyzedToken token)
token - public final void addMemberAndGroup(AnalyzedToken token)
setupAndGroup(), and followed by
checkAndGroup(boolean).token - AnalyzedToken - the token checked.public final void setupAndGroup()
public final boolean checkAndGroup(boolean previousValue)
public final boolean isAndExceptionGroupMatched(AnalyzedToken token)
token - AnalyzedToken - the token checked for exceptions.public final boolean isExceptionMatchedCompletely(AnalyzedToken token)
token - Token to matchpublic final void setAndGroupElement(Element andToken)
public final boolean hasAndGroup()
public final List<Element> getAndGroup()
public final boolean isMatchedByScopeNextException(AnalyzedToken token)
token - public final boolean isMatchedByPreviousException(AnalyzedToken token)
token - AnalyzedToken to check matching against.public final boolean isMatchedByPreviousException(AnalyzedTokenReadings prevToken)
prevToken - AnalyzedTokenReadings to check matching against.public final boolean isSentStart()
public final String toString()
toString in class Objectpublic final void setPosElement(String posToken,
boolean regExp,
boolean negation)
public final String getString()
public final void setStringElement(String token)
public final void setStringPosException(String token,
boolean regExp,
boolean inflected,
boolean negation,
boolean scopeNext,
boolean scopePrevious,
String posToken,
boolean posRegExp,
boolean posNegation)
token - The string in the exception.regExp - True if the string is specified as a regular expression.inflected - True if the string is a base form (lemma).negation - True if the exception is negated.scopeNext - True if the exception scope is next tokens.scopePrevious - True if the exception should match only a single previous token.posToken - The part of the speech tag in the exception.posRegExp - True if the POS is specified as a regular expression.posNegation - True if the POS exception is negated.public final int getSkipNext()
public final void setSkipNext(int i)
i - Exception scope length.public final boolean hasPreviousException()
public final boolean hasNextException()
public final void setNegation(boolean negation)
negation - - true if the meaning of match() is to be negated.public final boolean getNegation()
public final boolean isReferenceElement()
public final void setMatch(Match match)
match - Formatting object for the token reference.public final Match getMatch()
public final void compile(AnalyzedTokenReadings token, Synthesizer synth) throws IOException
token - the token specified as AnalyzedTokenReadingssynth - the language synthesizer (Synthesizer)IOExceptionpublic final void setPhraseName(String s)
s - ID of the phrase.public final boolean isPartOfPhrase()
public final boolean getCaseSensitive()
public final boolean isRegularExpression()
public final boolean isPOStagRegularExpression()
public final String getPOStag()
public final boolean getPOSNegation()
public final boolean isInflected()
public final String getPhraseName()
public final boolean isUnified()
public final void setUnification(Map<String,List<String>> uniFeatures)
public final Map<String,List<String>> getUniFeatures()
public final void setUniNegation()
public final boolean isUniNegated()
public final void setWhitespaceBefore(boolean isWhite)
public final void setExceptionSpaceBefore(boolean isWhite)
public final boolean isWhitespaceBefore(AnalyzedToken token)
public final List<Element> getExceptionList()
public final List<Element> getPreviousExceptionList()
public final boolean hasExceptionList()
public final boolean testWhitespace()
Copyright © 2005-2011 Daniel Naber