Package opennlp.tools.cmdline.parser
Class ParserTool
java.lang.Object
opennlp.tools.cmdline.CmdLineTool
opennlp.tools.cmdline.BasicCmdLineTool
opennlp.tools.cmdline.parser.ParserTool
public final class ParserTool
extends opennlp.tools.cmdline.BasicCmdLineTool
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetHelp()static opennlp.tools.parser.Parse[]Parses the specified pre-tokenized sentence and returns the requested number of parses or fewer.static opennlp.tools.parser.Parse[]static opennlp.tools.parser.Parse[]parseLine(String line, opennlp.tools.parser.Parser parser, opennlp.tools.tokenize.Tokenizer tokenizer, int numParses) voidExecutes the tool with the given parameters.Methods inherited from class opennlp.tools.cmdline.CmdLineTool
getName, hasParams
-
Constructor Details
-
ParserTool
public ParserTool()
-
-
Method Details
-
getShortDescription
- Overrides:
getShortDescriptionin classopennlp.tools.cmdline.CmdLineTool- Returns:
- Retrieves a short description of what the tool does
-
getHelp
- Specified by:
getHelpin classopennlp.tools.cmdline.CmdLineTool- Returns:
- Retrieves a description on how to use the tool
-
parseLine
public static opennlp.tools.parser.Parse[] parseLine(String line, opennlp.tools.parser.Parser parser, int numParses) -
parseLine
public static opennlp.tools.parser.Parse[] parseLine(String line, opennlp.tools.parser.Parser parser, opennlp.tools.tokenize.Tokenizer tokenizer, int numParses) -
parseLine
public static opennlp.tools.parser.Parse[] parseLine(String[] tokens, opennlp.tools.parser.Parser parser, int numParses) Parses the specified pre-tokenized sentence and returns the requested number of parses or fewer.This is a convenience method for cases where the input has already been tokenized into individual tokens. It avoids re-tokenizing and the need to manually construct the whitespace-separated text and compute character offsets.
- Parameters:
tokens- The tokens of the sentence to parse.parser- TheParserto use.numParses- The number of parses desired.- Returns:
- The specified number of
parsesfor the given tokens. - Throws:
IllegalArgumentException- iftokensisnullor empty.
-
run
Description copied from class:opennlp.tools.cmdline.BasicCmdLineToolExecutes the tool with the given parameters.- Specified by:
runin classopennlp.tools.cmdline.BasicCmdLineTool- Parameters:
args- arguments
-