Skip to content

Instantly share code, notes, and snippets.

@kennethleungty
Last active August 21, 2025 03:39
Show Gist options
  • Select an option

  • Save kennethleungty/42c42027a009dbdf78fa498982a19f7e to your computer and use it in GitHub Desktop.

Select an option

Save kennethleungty/42c42027a009dbdf78fa498982a19f7e to your computer and use it in GitHub Desktop.
import langextract as lx
examples = [
lx.data.ExampleData(
text="This policy does not cover damage caused by floods, earthquakes, or nuclear accidents.",
extractions=[
lx.data.Extraction(
extraction_class="exclusion",
extraction_text="floods",
attributes={
"plain_english": "Flood damage is not covered - you need separate flood insurance",
},
),
lx.data.Extraction(
extraction_class="exclusion",
extraction_text="earthquakes",
attributes={
"plain_english": "Earthquake damage is not covered - you need separate earthquake insurance",
},
),
lx.data.Extraction(
extraction_class="exclusion",
extraction_text="nuclear accidents",
attributes={
"plain_english": "Nuclear accident damage is not covered - you need separate nuclear accident insurance",
}
),
]
),
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment