Key methods for improving the accuracy of literary analysis:
- Refinement Cue Words: Explicit instructions such as
"Extract characters, emotions, and relationships in order of appearance..."Requires extraction in strict order of occurrence - Increase the number of examples: in
examplesAdd more labeled text snippets to the parameter - Use of high-quality models: Recommendations for Literary Analysis
gemini-2.5-promould - Post-processing validation: Manual validation by generating HTML visualization files
visualization.html
Typical implementation code:
# 定义提示词+示例
examples = [lx.data.ExampleData(
text="ROMEO. But soft! What light...",
extractions=[{"entity": "Romeo", "type": "character", "emotion": "hopeful"}]
)]
# 执行双重验证提取
result = lx.extract(text, prompt=prompt, examples=examples, model="gemini-2.5-pro", num_passes=2)
This answer comes from the articleLangExtract: open source tools to extract structured data from textThe































