Nasty.Language.English.QuestionAnalyzer (Nasty v0.3.0)

View Source

English question analysis for Question Answering.

Thin wrapper around generic question classifier with English-specific configuration. Classifies questions by interrogative word and determines expected answer type.

Summary

Types

Expected answer type for the question.

Question type based on interrogative word.

t()

Functions

Analyzes a question to extract type, expected answer type, and keywords.

Returns a human-readable description of the question analysis.

Checks if a question expects a specific entity type.

Types

answer_type()

@type answer_type() ::
  :person
  | :location
  | :time
  | :thing
  | :reason
  | :manner
  | :quantity
  | :boolean

Expected answer type for the question.

question_type()

@type question_type() ::
  :who | :what | :when | :where | :why | :how | :which | :yes_no

Question type based on interrogative word.

t()

@type t() :: %Nasty.Language.English.QuestionAnalyzer{
  answer_type: answer_type(),
  aux_verb: Nasty.AST.Token.t() | nil,
  focus: Nasty.AST.Token.t() | nil,
  keywords: [Nasty.AST.Token.t()],
  type: question_type()
}

Functions

analyze(tokens)

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

Analyzes a question to extract type, expected answer type, and keywords.

Delegates to generic question classifier with English configuration.

describe(question_analyzer)

@spec describe(t()) :: String.t()

Returns a human-readable description of the question analysis.

expects_entity_type?(question_analyzer, entity_type)

@spec expects_entity_type?(t(), atom()) :: boolean()

Checks if a question expects a specific entity type.

Delegates to QA config.