public class Term2Re
extends java.lang.Object
is a collection of static functions to support the translation of a multi word terms into regular expression which matches that term as well as orthographic variations.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
RE_SEP_WORD
2nd parameter passed to
createConverter() when creating the default converter used by
convert() . |
static java.lang.String |
RE_SPLIT_WORD
first parameter passed to
createConverter() when creating the default converter used by
convert() . |
static java.lang.String |
RE_TRAIL_CONTEXT
3rd parameter passed to
createConverter() when creating the default converter used by
convert() . |
static ReParser |
reParser
4th parameter passed to
createrConverter() when creating the default converter used by
convert() . |
Constructor and Description |
---|
Term2Re() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
convert(java.lang.String s)
converts a multi word term into a regular expression matching
that term as well as obvious generalizations.
|
static DfaRun |
createConverter(java.lang.String wordSplitRe,
java.lang.String wordSepRe,
java.lang.String trailContextRe,
ReParser rp)
creates a
DfaRun able to convert a multi word
term into a regular expression which matches obvious
orthographical variations of that term. |
static void |
main(java.lang.String[] argv)
|
public static final java.lang.String RE_SPLIT_WORD
first parameter passed to createConverter()
when creating the default converter used by
convert()
.
public static final java.lang.String RE_SEP_WORD
2nd parameter passed to createConverter()
when creating the default converter used by
convert()
.
public static final java.lang.String RE_TRAIL_CONTEXT
3rd parameter passed to createConverter()
when creating the default converter used by
convert()
.
public static final ReParser reParser
4th parameter passed to createrConverter()
when creating the default converter used by
convert()
.
public static DfaRun createConverter(java.lang.String wordSplitRe, java.lang.String wordSepRe, java.lang.String trailContextRe, ReParser rp) throws ReSyntaxException
creates a DfaRun
able to convert a multi word
term into a regular expression which matches obvious
orthographical variations of that term. You may then use the
machines filter functions to convert a multi word term to a
regular expression. The resulting regular expression will match
generalisations of the given term, e.g.
Note: This comment does not necessarily keep up with changes to the code.-(
wordSplitRe
- is the regular expression used to separate an
incoming term into individual words. See RE_SPLIT_WORD
for
an example.wordSepRe
- is a regular expression put between the regular
expressions generated for individual words of the multi word
term.rp
- must be an ReParser
of the type for which the
regular expression is generated. This is necessary to be able to
escape characters in original multi word term properly.trailContextRe
- is a regular expression which will be
finally appended to the result.ReSyntaxException
public static java.lang.String convert(java.lang.String s)
converts a multi word term into a regular expression matching
that term as well as obvious generalizations. The algorithm is
not finalized yet. The converter used is created with createConverter(java.lang.String, java.lang.String, java.lang.String, monq.jfa.ReParser)
with RE_SEP_WORD
, RE_SPLIT_WORD
and RE_TRAIL_CONTEXT
as parameters.
public static void main(java.lang.String[] argv) throws java.io.IOException
applies convert
to every line read from
System.in
and writes the result to
System.out
.
java.io.IOException