Package opennlp.tools.parser

# Interface Parser

public interface Parser
Defines common methods for full-syntactic parsers.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `INC_NODE`
  The label for the top if an incomplete node.
  `static final String`
  `TOK_NODE`
  The label for a token node.
  `static final String`
  `TOP_NODE`
  The label for the top node.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Parse`
  `parse(Parse tokens)`
  Returns a `Parse` for the specified `Parse` of `tokens`.
  `Parse[]`
  `parse(Parse tokens, int numParses)`
  Returns the specified number of parses or fewer for the specified tokens.

- ## Field Details

  - ### TOP_NODE

    static final String TOP_NODE
    The label for the top node.
    See Also:
      - Constant Field Values

  - ### INC_NODE

    static final String INC_NODE
    The label for the top if an incomplete node.
    See Also:
      - Constant Field Values

  - ### TOK_NODE

    static final String TOK_NODE
    The label for a token node.
    See Also:
      - Constant Field Values

- ## Method Details

  - ### parse

    Parse[] parse(Parse tokens, int numParses)
    Returns the specified number of parses or fewer for the specified tokens.

    Note: The nodes within the returned parses are shared with other parses and therefore their parent node references will not be consistent with their child node reference.

    `Parse.setParent(Parse)` can be used to make the parents consistent with a particular parse, but subsequent calls to `setParents` can invalidate the results of earlier calls.

    Parameters:
      `tokens` - A `Parse` containing the tokens with a single parent node.
      `numParses` - The number of parses desired.
    Returns:
      the specified number of `parses` for the specified `tokens`.

  - ### parse

    Parse parse(Parse tokens)
    Returns a `Parse` for the specified `Parse` of `tokens`.
    Parameters:
      `tokens` - The root node of a flat parse containing only tokens.
    Returns:
      A full parse of the specified tokens or the flat chunks of the tokens if a full parse could not be found.