Nasty.Language.Catalan.Parser (Nasty v0.3.0)

View Source

Parser for Catalan sentences and phrases.

Builds a complete Document AST from POS-tagged tokens by:

  1. Parsing sentences into clause structures
  2. Constructing paragraphs from sentences
  3. Creating document with proper span tracking
  4. Adding metadata (token count, sentence count)

Examples

iex> {:ok, tokens} = Catalan.Tokenizer.tokenize("El gat dorm.")
iex> {:ok, tagged} = Catalan.POSTagger.tag_pos(tokens)
iex> {:ok, analyzed} = Catalan.Morphology.analyze(tagged)
iex> Parser.parse(analyzed)
{:ok, %Document{paragraphs: [%Paragraph{sentences: [...]}]}}

Summary

Functions

Parses morphologically-analyzed Catalan tokens into a Document AST.

Functions

parse(tokens, opts \\ [])

@spec parse(
  [Nasty.AST.Token.t()],
  keyword()
) :: {:ok, Nasty.AST.Document.t()} | {:error, term()}

Parses morphologically-analyzed Catalan tokens into a Document AST.

Options

  • :dependencies - Extract dependency relations (default: false)
  • :entities - Recognize named entities (default: false)
  • :semantic_roles - Extract semantic roles (default: false)

Returns

{:ok, document} on success, {:error, reason} on failure.