public class Options
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Class and Description |
---|---|
static class |
Options.LexOptions |
Modifier and Type | Field and Description |
---|---|
double |
baseParserWeight
If reranking sentences, we can use the score from the original
parser as well.
|
boolean |
coarseDistance
Use coarser distance (4 bins) in dependency calculations
|
boolean |
dcTags
"double count" tags rewrites as word in PCFG and Dep parser.
|
boolean |
directional
Whether dependency grammar considers left/right direction.
|
boolean |
distance
Use distance bins in the dependency calculations
|
boolean |
doDep
Do a dependency parse of the sentence.
|
boolean |
doPCFG
Do a PCFG parse of the sentence.
|
boolean |
forceCNF
Forces parsing with strictly CNF grammar -- unary chains are converted
to XP&YP symbols and back
|
boolean |
freeDependencies
if true, any child can be the head (seems rather bad!)
|
boolean |
genStop |
Options.LexOptions |
lexOptions |
boolean |
nodePrune
If true, inside the factored parser, remove any node from the final
chosen tree which improves the PCFG score.
|
int |
rerankerKBest
If the parser has a reranker, it looks at this many trees when
building the reranked list.
|
TestOptions |
testOptions
Note that the TestOptions is transient.
|
TreebankLangParserParams |
tlpParams
The treebank-specific parser parameters to use.
|
TrainOptions |
trainOptions |
boolean |
useSmoothTagProjection |
boolean |
useUnigramWordSmoothing |
java.util.function.Function<java.lang.String,java.lang.String> |
wordFunction
A function that maps words used in training and testing to new
words.
|
Constructor and Description |
---|
Options() |
Options(TreebankLangParserParams tlpParams) |
Modifier and Type | Method and Description |
---|---|
void |
display() |
TreebankLanguagePack |
langpack() |
TestOptions |
newTestOptions()
Separated out so subclasses of Options can override
|
TrainOptions |
newTrainOptions()
Separated out so subclasses of Options can override
|
void |
readData(java.io.BufferedReader in)
Populates data in this Options from the character stream.
|
int |
setOption(java.lang.String[] flags,
int i)
Set an option based on a String array in the style of
commandline flags.
|
protected int |
setOptionFlag(java.lang.String[] args,
int i)
Set an option in this object, based on a String array in the style of
commandline flags.
|
int |
setOptionOrWarn(java.lang.String[] flags,
int i)
Set an option based on a String array in the style of
commandline flags.
|
void |
setOptions(java.lang.String... flags)
Set options based on a String array in the style of
commandline flags.
|
void |
setOptions(java.lang.String[] flags,
int startIndex,
int endIndexPlusOne)
Set options based on a String array in the style of
commandline flags.
|
void |
setOptionsOrWarn(java.lang.String... flags)
Set options based on a String array in the style of
commandline flags.
|
void |
setOptionsOrWarn(java.lang.String[] flags,
int startIndex,
int endIndexPlusOne)
Set options based on a String array in the style of
commandline flags.
|
void |
writeData(java.io.Writer w) |
public Options.LexOptions lexOptions
public TreebankLangParserParams tlpParams
public boolean forceCNF
public boolean doPCFG
public boolean doDep
public boolean freeDependencies
public boolean directional
public boolean genStop
public boolean useSmoothTagProjection
public boolean useUnigramWordSmoothing
public boolean distance
public boolean coarseDistance
public boolean dcTags
public boolean nodePrune
public TrainOptions trainOptions
public transient TestOptions testOptions
public java.util.function.Function<java.lang.String,java.lang.String> wordFunction
public int rerankerKBest
public double baseParserWeight
public Options()
public Options(TreebankLangParserParams tlpParams)
public void setOptions(java.lang.String... flags)
setOption(java.lang.String[], int)
.flags
- Array of options (or as a varargs list of arguments).
The options passed in should
be specified like command-line arguments, including with an initial
minus sign for example,
{"-outputFormat", "typedDependencies", "-maxLength", "70"}java.lang.IllegalArgumentException
- If an unknown flag is passed inpublic void setOptions(java.lang.String[] flags, int startIndex, int endIndexPlusOne)
setOption(java.lang.String[], int)
.flags
- Array of options. The options passed in should
be specified like command-line arguments, including with an initial
minus sign for example,
{"-outputFormat", "typedDependencies", "-maxLength", "70"}startIndex
- The index in the array to begin processing options atendIndexPlusOne
- A number one greater than the last array index at
which options should be processedjava.lang.IllegalArgumentException
- If an unknown flag is passed inpublic void setOptionsOrWarn(java.lang.String... flags)
setOption(java.lang.String[], int)
.flags
- Array of options (or as a varargs list of arguments).
The options passed in should
be specified like command-line arguments, including with an initial
minus sign for example,
{"-outputFormat", "typedDependencies", "-maxLength", "70"}java.lang.IllegalArgumentException
- If an unknown flag is passed inpublic void setOptionsOrWarn(java.lang.String[] flags, int startIndex, int endIndexPlusOne)
setOption(java.lang.String[], int)
.flags
- Array of options. The options passed in should
be specified like command-line arguments, including with an initial
minus sign for example,
{"-outputFormat", "typedDependencies", "-maxLength", "70"}startIndex
- The index in the array to begin processing options atendIndexPlusOne
- A number one greater than the last array index at
which options should be processedjava.lang.IllegalArgumentException
- If an unknown flag is passed inpublic int setOptionOrWarn(java.lang.String[] flags, int i)
-maxLength n
set the maximum length sentence to parse (inclusively)
-printTT
print the training trees in raw, annotated, and annotated+binarized form. Useful for debugging and other miscellany.
-printAnnotated filename
use only in conjunction with -printTT. Redirects printing of annotated training trees to filename
.
-forceTags
when the parser is tested against a set of gold standard trees, use the tagged yield, instead of just the yield, as input.
flags
- An array of options arguments, command-line style. E.g. {"-maxLength", "50"}.i
- The index in flags to start at when processing an optioni+1
public int setOption(java.lang.String[] flags, int i)
-maxLength n
set the maximum length sentence to parse (inclusively)
-printTT
print the training trees in raw, annotated, and annotated+binarized form. Useful for debugging and other miscellany.
-printAnnotated filename
use only in conjunction with -printTT. Redirects printing of annotated training trees to filename
.
-forceTags
when the parser is tested against a set of gold standard trees, use the tagged yield, instead of just the yield, as input.
flags
- An array of options arguments, command-line style. E.g. {"-maxLength", "50"}.i
- The index in flags to start at when processing an optionjava.lang.IllegalArgumentException
- If the current array position cannot be
processed as a valid optionprotected int setOptionFlag(java.lang.String[] args, int i)
-maxLength n
set the maximum length sentence to parse (inclusively)
-printTT
print the training trees in raw, annotated, and annotated+binarized form. Useful for debugging and other miscellany.
-printAnnotated filename
use only in conjunction with -printTT. Redirects printing of annotated training trees to filename
.
-forceTags
when the parser is tested against a set of gold standard trees, use the tagged yield, instead of just the yield, as input.
args
- An array of options arguments, command-line style. E.g. {"-maxLength", "50"}.i
- The index in args to start at when processing an optionpublic TreebankLanguagePack langpack()
public TrainOptions newTrainOptions()
public TestOptions newTestOptions()
public void display()
public void writeData(java.io.Writer w)
public void readData(java.io.BufferedReader in) throws java.io.IOException
in
- The Readerjava.io.IOException
- If there is a problem reading data