ner.base
The span-tagger interface. Nothing here imports a model or an SDK.
NerError
The call cannot be answered: too many labels for the model, a model error, a bad input.
Span
SpanTagger
Finds labelled spans in text, with no generation.
Construct with SpanTagger(*args, **kwargs).
ner.candidates
Spans as candidates: the join between a tagger and the extractor’s grounding.
spans_to_candidates
ner.fake
A scripted tagger for tests: it finds the phrases it was given, under the labels it was given.
FakeSpanTagger
rules: label -> phrases to find (case-sensitive, every occurrence).
Construct with FakeSpanTagger(rules: Mapping[str, Sequence[str]], *, labels_per_call: int \| None = None, max_chars: int \| None = None, score: float = 0.9).
ner.labels
Working with a tagger that carries few labels per call: split the labels, run each group, merge the spans.
arecognize_all
clashes
merge_spans
recognize_all
tagger.recognize for any number of labels.
ner.litert_gliner
GLiNER as a LiteRT model on this machine: zero-shot NER (any labels you name, no training) from a .tflite, as a SpanTagger.
Encoded
LiteRtGliner
SpanTagger over a GLiNER .tflite.
Construct with LiteRtGliner(tflite_path: str \| pathlib.Path, *, tokenizer: str \| pathlib.Path = 'gliner-community/gliner_small-v2.5', cache_dir: str \| pathlib.Path \| None = None, device: str = 'gpu', local_files_only: bool = False, encoder_kind: Literal['auto', 'tokenizers', 'gliner'] = 'auto', runtime: _Runtime \| None = None, encoder: _Encoder \| None = None).
decode_spans
to_spans
text.
ner.tokenizers_encoder
GLiNER’s input preparation without PyTorch: the tokenizers library, a regex and numpy.
TokenizersEncoder
Implements the encoder protocol of litert_gliner.
Construct with TokenizersEncoder(checkpoint: str \| pathlib.Path, *, cache_dir: str \| pathlib.Path \| None = None, local_files_only: bool = False).
ner.windows
Text longer than a tagger can take: cut it into overlapping word windows, tag each, move the spans back, merge.
recognize_windowed
word_windows
text, window text)], size words each, stepping size - overlap words.