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
  Constructor
  Description
  `ParserTool()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getHelp()`
  `String`
  `getShortDescription()`
  `static Parse[]`
  `parseLine(String[] tokens, Parser parser, int numParses)`
  Parses the specified pre-tokenized sentence and returns the requested number of parses or fewer.
  `static Parse[]`
  `parseLine(String line, Parser parser, int numParses)`
  `static Parse[]`
  `parseLine(String line, Parser parser, Tokenizer tokenizer, int numParses)`
  `void`
  `run(String[] args)`
  Executes the tool with the given parameters.

  ### Methods inherited from class opennlp.tools.cmdline.CmdLineTool

  `getName, hasParams`

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### ParserTool

    public ParserTool()

- ## Method Details

  - ### getShortDescription

    public String getShortDescription()
    Overrides:
      `getShortDescription` in class `opennlp.tools.cmdline.CmdLineTool`
    Returns:
      Retrieves a short description of what the tool does

  - ### getHelp

    public String getHelp()
    Specified by:
      `getHelp` in class `opennlp.tools.cmdline.CmdLineTool`
    Returns:
      Retrieves a description on how to use the tool

  - ### parseLine

    public static Parse[] parseLine(String line, Parser parser, int numParses)

  - ### parseLine

    public static Parse[] parseLine(String line, Parser parser, Tokenizer tokenizer, int numParses)

  - ### parseLine

    public static Parse[] parseLine(String[] tokens, 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` - The `Parser` to use.
      `numParses` - The number of parses desired.
    Returns:
      The specified number of `parses` for the given tokens.
    Throws:
      `IllegalArgumentException` - if `tokens` is `null` or empty.

  - ### run

    public void run(String[] args)
    Description copied from class: `opennlp.tools.cmdline.BasicCmdLineTool`
    Executes the tool with the given parameters.
    Specified by:
      `run` in class `opennlp.tools.cmdline.BasicCmdLineTool`
    Parameters:
      `args` - arguments