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

opennlp.tools.parser

## Interface HeadRules

- All Known Implementing Classes:
    AncoraSpanishHeadRules, HeadRules

      public interface HeadRules

  Interface for encoding the head rules associated with parsing.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `Parse` | `getHead(Parse[] constituents, String type)` Returns the head constituent for the specified constituents of the specified type.
    `Set<String>` | `getPunctuationTags()` Returns the set of punctuation tags.

- - ### Method Detail

    - #### getHead

          Parse getHead(Parse[] constituents,
                        String type)

      Returns the head constituent for the specified constituents of the specified type.
      Parameters:
        `constituents` - The constituents which make up a constituent of the specified type.
        `type` - The type of a constituent which is made up of the specified constituents.
      Returns:
        The constituent which is the head.

    - #### getPunctuationTags

          Set<String> getPunctuationTags()

      Returns the set of punctuation tags. Attachment decisions for these tags will not be modeled.
      Returns:
        the set of punctuation tags.

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