public class TregexPatternCompiler extends Object
| Modifier and Type | Field and Description |
|---|---|
static TregexPatternCompiler |
defaultCompiler |
| Constructor and Description |
|---|
TregexPatternCompiler() |
TregexPatternCompiler(Function<String,String> basicCatFunction)
A compiler that uses this basicCatFunction and the default HeadFinder.
|
TregexPatternCompiler(HeadFinder headFinder)
A compiler that uses this HeadFinder and the default basicCategoryFunction
|
TregexPatternCompiler(HeadFinder headFinder,
Function<String,String> basicCatFunction)
A compiler that uses this HeadFinder and this basicCategoryFunction
|
| Modifier and Type | Method and Description |
|---|---|
void |
addMacro(String original,
String replacement)
Define a macro for rewriting a pattern in any tregex expression compiled
by this compiler.
|
TregexPattern |
compile(String tregex)
Create a TregexPattern from this tregex string using the headFinder and
basicCat function this TregexPatternCompiler was created with.
|
public static final TregexPatternCompiler defaultCompiler
public TregexPatternCompiler()
public TregexPatternCompiler(Function<String,String> basicCatFunction)
basicCatFunction - the function mapping Strings to Stringspublic TregexPatternCompiler(HeadFinder headFinder)
headFinder - the HeadFinderpublic TregexPatternCompiler(HeadFinder headFinder, Function<String,String> basicCatFunction)
headFinder - the HeadFinderbasicCatFunction - The function mapping Strings to Stringspublic void addMacro(String original, String replacement)
tpc.addMacro("FINITE_BE_AUX", "/^(?i:am|is|are|was|were)$/");original - The String to match; becomes the first argument of a
String.replaceAll()replacement - The replacement String; becomes the second argument
of a String.replaceAll()public TregexPattern compile(String tregex)
tregex - The pattern to parseTregexParseException - If the expression is syntactically invalid