Skip to main content

extractors.build

Build the extractor a deployment asked for: the extractor: section of ladygraph.yaml, and the LADYGRAPH_EXTRACTOR switch.

build_extractor

The extractor for config (a config object, or the path of a ladygraph.yaml: its prompt: section is read too).

build_llm

build_tagger

effective_kind

extractor.kind, unless LADYGRAPH_EXTRACTOR is set: then that.

extractors.compare

Run two extractors on the same Document and say where they differ, without writing anything: the way to see what a flag would change.

Comparison

compare_extractors

a and b are extractors (anything with extract); every passage of doc is treated as changed.

extractors.config

The extractor: section of ladygraph.yaml: which extractor builds the concepts, and how. This is the feature flag.

ExtractorConfig

NerConfig

TaggerConfig

A GLiNER model on this machine (ner.litert_gliner.LiteRtGliner).

TranslateSettings

For translate_ner: the passage is translated, the translation is tagged, and each find is mapped back to a quote in the original.

load_extractor_config

The extractor: section of a ladygraph.yaml; the first version (llm_okf) when the file has no such section.

resolve_paths

Make the file paths of the config absolute, taken from base (the folder of ladygraph.yaml), so the program can start from anywhere.

extractors.declared

Concepts from entries that a human already described, with no LLM (INTERFACE §6, DeclaredExtractor).

DeclaredExtractor

Construct with DeclaredExtractor(*, embedder: Embedder \| None = None, types: dict[str, str] \| None = None, producer: str = 'declared', clock: Callable[[], datetime.datetime] = <function DeclaredExtractor.<lambda> at 0x10434c4a0>).

DeclaredOrLlm

A declared Document goes to the declared extractor, any other to the LLM extractor. Construct with DeclaredOrLlm(declared: Extractor, llm: Extractor).

extractors.lexicon

Lexicon entries as concepts, chained to the concepts of the documents (LexiconExtractor).

LexiconExtractor

Construct with LexiconExtractor(inner: Extractor, engine: EntityEngine, lexicon: Lexicon, *, embedder: Embedder \| None = None, producer: str = 'lexicon', clock: Callable[[], datetime.datetime] = <function LexiconExtractor.<lambda> at 0x10434c400>).

extractors.llm_okf

LLM extractor: one changed Document in, one Contribution out (see extractors/docs/LOGIC.md).

ContextPick

LlmOkfExtractor

Construct with LlmOkfExtractor(llm: LlmClient, *, embedder: Embedder \| None = None, producer: str = 'llm-okf', clock: Callable[[], datetime.datetime] = <function LlmOkfExtractor.<lambda> at 0x1042fa160>, prompt: PromptConfig \| None = None).

evidence_id

locate_quote

Find quote in the faithfully normalized text of a changed passage.

pick_prompt

render_document

The whole document as one text.

extractors.ner_extractor

Extractors that find concepts with a span tagger instead of (or beside) a model’s reading of the document.

NerExtractor

Construct with NerExtractor(llm: LlmClient, tagger: SpanTagger, config: NerConfig, *, embedder: Embedder \| None = None, producer: str \| None = None, clock: Callable[[], datetime.datetime] = <function NerExtractor.<lambda> at 0x1042fb100>, prompt: PromptConfig \| None = None, relations: bool = True, relations_llm: LlmClient \| None = None).

extractors.prompt

The wording of the extraction prompts, as data: the prompt: section of ladygraph.yaml.

ExampleConcept

ExampleRelation

PickPrompt

The prompt that places a concept in the topic tree.

PromptConfig

PromptExample

load_prompt

The prompt: section of a ladygraph.yaml; the default wording when the file has no such section.

extractors.reading

Write each flattened config entry as a cohesive reading before it is extracted (ReadingExtractor).

Reading

The entry as a few short typed fields that the code stitches into one block of prose, in a fixed order.

ReadingExtractor

Wraps an extractor. An entry that asks for a rewrite gets a reading and its quoted words; any other Document (declared, prose, SQL) goes straight to the inner extractor. Construct with ReadingExtractor(inner: Extractor, llm: LlmClient, *, clock: Callable[[], datetime.datetime] = <function ReadingExtractor.<lambda> at 0x10434d580>).

mask_quotes

Each quotation as a token [[Q1: term]].

quoted_spans

Every usable quotation in the text, with its quotation marks, exactly as written.

quoted_words

The words a person put in quotation marks, as match clauses (a & b & !c), in order and without repeats.

unmask_quotes

The text with every token replaced by the original quotation, character for character, whatever the model wrote inside the token.

extractors.translate_ner

translate_ner: concepts found in a TRANSLATION, grounded in the ORIGINAL.

TranslateNerExtractor

Construct with TranslateNerExtractor(llm: LlmClient, tagger: SpanTagger, config: NerConfig, settings: TranslateSettings \| None = None, *, translate_llm: LlmClient \| None = None, escalate_llm: LlmClient \| None = None, backquote_llm: LlmClient \| None = None, hints: Callable[[str], str] \| None = None, check: Callable[[str, str], list[str]] \| None = None, embedder: Embedder \| None = None, producer: str \| None = None, clock: Callable[[], datetime.datetime] = <function TranslateNerExtractor.<lambda> at 0x1042fb060>, prompt: PromptConfig \| None = None, relations: bool = True, relations_llm: LlmClient \| None = None).