public class ParserOptions
extends java.lang.Object
This object is extended by other members of the NineML family to provide additional options. It started out as a collection of public fields, but changed to a more traditional collection of getters and setters when it began to develop options that were not entirely independent.
Constructor and Description |
---|
ParserOptions()
Create the parser options.
|
ParserOptions(Logger logger)
Create the parser options with an explicit logger.
|
ParserOptions(ParserOptions copy)
Create a new set of options from an existing set.
|
Modifier and Type | Method and Description |
---|---|
Logger |
getLogger()
The parser logger.
|
boolean |
getMarkAmbiguities()
Are individual ambiguities be marked?
|
boolean |
getNormalizeLineEndings()
Should line endings be normalized?
|
java.lang.String |
getParserType()
Return the default parser type.
|
boolean |
getPrefixParsing()
If a parse fails, but some prefix of the input was successfully parsed, make that available.
|
java.lang.String |
getPriorityStyle()
The priority style.
|
ProgressMonitor |
getProgressMonitor()
The progress monitor.
|
boolean |
getReturnChart()
Return the Earley chart even for a successful parse?
|
void |
setLogger(Logger logger)
Set the logger.
|
void |
setMarkAmbiguities(boolean mark)
Set ambiguity marking.
|
void |
setNormalizeLineEndings(boolean normalize)
Set normalize line endings
|
void |
setParserType(java.lang.String parserType)
Set the default parser type.
|
void |
setPrefixParsing(boolean prefixParsing)
Set the
getPrefixParsing() property. |
void |
setPriorityStyle(java.lang.String style)
Set the priority style.
|
void |
setProgressMonitor(ProgressMonitor monitor)
Set the progress monitor.
|
void |
setReturnChart(boolean returnChart)
Set the
getReturnChart() property. |
public ParserOptions()
The initial logger will be a DefaultLogger
initialized with
readSystemProperties()
.
public ParserOptions(Logger logger)
logger
- the logger.public ParserOptions(ParserOptions copy)
Beware that the logger and monitor are not copied, so the copied options have pointers to the same logger and monitor instances.
copy
- the options to copypublic java.lang.String getParserType()
public void setParserType(java.lang.String parserType)
parserType
- the parser type, "Earley" or "GLL"java.lang.IllegalArgumentException
- if the parser type is not recognizedpublic boolean getReturnChart()
public void setReturnChart(boolean returnChart)
getReturnChart()
property.returnChart
- return the chart?public boolean getPrefixParsing()
This is optional mostly because it requires internally buffering some of the input tokens. (Probably no more than two, but I haven't tried to prove that.)
public void setPrefixParsing(boolean prefixParsing)
getPrefixParsing()
property.prefixParsing
- prefix parsing?public Logger getLogger()
The logger controls what messages are issued, and how. This component is also used by higher-level components such as CoffeeFilter, CoffeePot, and CoffeeSacks.
public void setLogger(Logger logger)
logger
- the logger.java.lang.NullPointerException
- if the logger is null.public ProgressMonitor getProgressMonitor()
If this option is not null, the monitor will be called before, during, and after the parse.
public void setProgressMonitor(ProgressMonitor monitor)
Setting the monitor to null
disables monitoring.
monitor
- the monitor.public java.lang.String getPriorityStyle()
Priorities can be computed on one of two styles: "max
" or "sum
".
If the priority style is "max
", the priority of any given node is the highest priority
value in the subgraph rooted at the current node.
If the priority style is "sum
", the priority of any given node is the sum of the priorities
of the nodes in the subgraph rooted at the current node.
public void setPriorityStyle(java.lang.String style)
The style can be "max
" or "sum
". The default is "max
".
style
- the priority style.public boolean getNormalizeLineEndings()
If line endings are normalized, all occurrences of #D, #D#A, #85, and #2028 in the input string are replaced with a single #A. This only applies to sequences of characters in the input.
public void setNormalizeLineEndings(boolean normalize)
If line endings are normalized, all occurrences of #D, #D#A, #85, and #2028 in the input string are replaced with a single #A. This only applies to sequences of characters in the input.
normalize
- true if line endings should be normalizedpublic boolean getMarkAmbiguities()
public void setMarkAmbiguities(boolean mark)
mark
- true if individual ambiguities should be marked.