Interface DependencyParser


public interface DependencyParser
The interface for dependency parsers, which assign every token of a sentence a syntactic head and a relation label, forming a single-rooted tree over the sentence.

Dependency parsing complements the constituency Parser: where a constituency parse groups tokens into nested phrases, a dependency parse links each token directly to the token it modifies. The result is a DependencyTree whose indices refer back to the input token array, so spans computed for those tokens remain valid for the parse.

Thread safety is implementation specific.

Since:
3.0.0
See Also:
  • Method Details

    • parse

      DependencyTree parse(String[] tokens, String[] tags)
      Parses a sentence into a DependencyTree.
      Parameters:
      tokens - The input tokens. Must not be null, must contain at least one token, and must not contain null entries.
      tags - The part-of-speech tags aligned with tokens. Must not be null, must have the same length as tokens, and must not contain null entries.
      Returns:
      A DependencyTree over the given tokens. Never null.
      Throws:
      IllegalArgumentException - Thrown if tokens or tags is null, empty, of mismatched length, or contains a null entry.