Nasty.Language.English.AnswerExtractor (Nasty v0.3.0)
View SourceEnglish answer extraction for Question Answering.
Thin wrapper around generic QA engine with English-specific configuration. Extracts answer spans from documents based on question analysis.
Summary
Functions
Extracts answers from a document based on question analysis.
Functions
@spec extract( Nasty.AST.Document.t(), Nasty.Language.English.QuestionAnalyzer.t(), keyword() ) :: [ Nasty.AST.Answer.t() ]
Extracts answers from a document based on question analysis.
Delegates to generic QA engine with English configuration.
Options
:max_answers- Maximum number of answers to return (default: 3):min_confidence- Minimum confidence threshold (default: 0.1):max_sentences- Maximum sentences to extract from (default: 10)
Examples
iex> document = parse_document("John Smith founded Google in 1998.")
iex> question_analysis = %QuestionAnalyzer{type: :who, answer_type: :person, keywords: [...]}
iex> answers = AnswerExtractor.extract(document, question_analysis)
[%Answer{text: "John Smith", confidence: 0.85, ...}]