Parser (Apache OpenNLP Tools 1.9.5 API)
Date: 2026-06-18

opennlp.tools.parser

## Interface Parser

- All Known Implementing Classes:
    AbstractBottomUpParser, Parser, Parser

      public interface Parser

  Interface for full-syntactic parsers.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and 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.

- - ### Method Detail

    - #### 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 fullparse could not be found.

Copyright © 2026 The Apache Software Foundation. All rights reserved.