de.danielnaber.languagetool.rules.patterns
Class Match

Object
  extended by Match

public class Match
extends Object

Reference to a matched token in a pattern, can be formatted and used for matching & suggestions.

Author:
Marcin MiƂkowski

Nested Class Summary
static class Match.CaseConversion
          Possible string case conversions.
 
Constructor Summary
Match(String posTag, String posTagReplace, boolean postagRegexp, String regexMatch, String regexReplace, Match.CaseConversion caseConversionType, boolean setPOS)
           
 
Method Summary
 boolean convertsCase()
          Used to let LT know that it should change the case of the match.
 AnalyzedTokenReadings filterReadings()
           
 String getTargetPosTag()
          Format POS tag using parameters already defined in the class.
 int getTokenRef()
          Gets the token number referenced by the match.
 boolean isInMessageOnly()
           
 boolean posRegExp()
          Checks if the Match element uses regexp-based form of the POS tag.
 void setInMessageOnly(boolean inMessageOnly)
           
 void setLemmaString(String lemmaString)
          Sets a base form (lemma) that will be formatted, or synthesized, using the specified POS regular expressions.
 boolean setsPos()
          Checks if the Match element is used for setting the part of speech Element.
 void setSynthesizer(Synthesizer synth)
          Sets a synthesizer used for grammatical synthesis of forms based on formatted POS values.
 void setToken(AnalyzedTokenReadings token)
          Sets the token that will be formatted or otherwise used in the class.
 void setTokenRef(int i)
          Sets the token number referenced by the match.
 String[] toFinalString()
          Gets all strings formatted using the match element.
 String toTokenString()
          Method for getting the formatted match as a single string.
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Match

public Match(String posTag,
             String posTagReplace,
             boolean postagRegexp,
             String regexMatch,
             String regexReplace,
             Match.CaseConversion caseConversionType,
             boolean setPOS)
Method Detail

setToken

public final void setToken(AnalyzedTokenReadings token)
Sets the token that will be formatted or otherwise used in the class.

Parameters:
token -

setsPos

public final boolean setsPos()
Checks if the Match element is used for setting the part of speech Element.

Returns:
True if Match sets POS.

posRegExp

public final boolean posRegExp()
Checks if the Match element uses regexp-based form of the POS tag.

Returns:
True if regexp is used in POS.

setLemmaString

public final void setLemmaString(String lemmaString)
Sets a base form (lemma) that will be formatted, or synthesized, using the specified POS regular expressions.

Parameters:
lemmaString -

setSynthesizer

public final void setSynthesizer(Synthesizer synth)
Sets a synthesizer used for grammatical synthesis of forms based on formatted POS values.

Parameters:
synth -

toFinalString

public final String[] toFinalString()
                             throws IOException
Gets all strings formatted using the match element.

Returns:
Throws:
IOException - in case of synthesizer-related disk problems.

getTargetPosTag

public final String getTargetPosTag()
Format POS tag using parameters already defined in the class.

Returns:
Formatted POS tag as

toTokenString

public final String toTokenString()
                           throws IOException
Method for getting the formatted match as a single string. In case of multiple matches, it joins them using a regular expression operator "|".

Returns:
Formatted string of the matched token.
Throws:
IOException

setTokenRef

public final void setTokenRef(int i)
Sets the token number referenced by the match.

Parameters:
i - Token number.

getTokenRef

public final int getTokenRef()
Gets the token number referenced by the match.

Returns:
int - token number.

convertsCase

public final boolean convertsCase()
Used to let LT know that it should change the case of the match.

Returns:
true if match converts the case of the token.

filterReadings

public final AnalyzedTokenReadings filterReadings()

setInMessageOnly

public void setInMessageOnly(boolean inMessageOnly)
Parameters:
inMessageOnly - the inMessageOnly to set

isInMessageOnly

public boolean isInMessageOnly()
Returns:
the inMessageOnly


Copyright © 2005-2009 Daniel Naber