|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object frej.Regex
public final class Regex
Class represents fuzzy regular expression at whole. Pattern of fuzzy regexp is passed as string to constructor. Then any string could be checked against this regexp with the help of match, matchFromStart or presentInSequence methods. After matching it is possible to receive replacement for matched region via getReplacement method. Few more auxiliary methods provided for handling parts of original string and result.
Constructor Summary | |
---|---|
Regex(String pattern)
Creates new regular expression (builds it as a tree of elements) from presented pattern. |
|
Regex(String pattern,
double threshold,
String punctuators)
Creates new regular expression from presented pattern, specifying also settings of threshold value and allowed punctuation marks. |
Method Summary | |
---|---|
int |
getMatchEnd()
Tells the character position (of string which have been matched) where last match ends (i.e. position strictly following last character of matched region). |
double |
getMatchResult()
Returns result of the last match. |
int |
getMatchStart()
Tells the character position (of string which have been matched) from which the match starts. |
String |
getReplacement()
Gives replacement string which is generated after successful match according to rules specified in regexp pattern. |
double |
getThreshold()
Returns value of threshold used in matching methods to decide whether matching result signifies match or mismatch. |
boolean |
match(String seq)
Check whether presented string matches with this regexp with all tokens. |
int |
matchedTokenCount()
Tells number of tokens in matched region (mostly important when pattern contains optional elements). |
boolean |
matchFromStart(String seq)
Checks whether this regexp matches to beginning of presented sequence. |
String |
pattern()
Reconstructs pattern which was used for creation of this regexp. |
String |
prefix()
Returns the part of matched string, which precedes matching region. |
int |
presentInSequence(String seq)
Checks whether this regexp matches to any subsequence in presented string. |
String |
setAllowedPunctuationMarks(String punct)
Allows to set up which punctuation marks are allowed in the tokens By default only slash and dash i.e. punct = "/-" |
void |
setThreshold(double t)
Sets value of threshold used in matching methods to decide whether matching result signifies match or mismatch. |
String |
suffix()
Returns the part of matched string, which follows matching region. |
Methods inherited from class Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Regex(String pattern)
public Regex(String pattern, double threshold, String punctuators)
Method Detail |
---|
public int presentInSequence(String seq)
public boolean match(String seq)
public boolean matchFromStart(String seq)
public double getMatchResult()
public String getReplacement()
public int getMatchStart()
public int getMatchEnd()
public String pattern()
public int matchedTokenCount()
public String prefix()
public String suffix()
public String setAllowedPunctuationMarks(String punct)
public double getThreshold()
public void setThreshold(double t)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |