Usage

ssslm.model Module

A data model for synonyms.

Functions

append_literal_mapping(literal_mapping, path)

Append a literal mapping to an existing file.

df_to_literal_mappings(...)

Get mapping objects from a dataframe.

get_prefixes(literal_mapping_index)

Get all prefixes appearing in a literal mapping index or iterable of literal mappings.

group_literal_mappings(literal_mappings)

Aggregate literal mappings by reference.

lint_literal_mappings(path, *[, delimiter, ...])

Lint a literal mappings file.

literal_mappings_to_df(literal_mappings)

Get a pandas dataframe from the literal mappings.

literal_mappings_to_gilda(literal_mappings, *)

Convert literal mappings to gilda terms.

read_gilda_terms(...)

Read Gilda terms from a file.

read_literal_mappings(...)

Load literal mappings from a file.

remap_literal_mappings(literal_mappings, ...)

Use a priority mapping to re-write terms with priority groundings.

write_gilda_terms(literal_mappings, path, *)

Write Gilda terms to a file.

write_literal_mappings(literal_mappings, path, *)

Write literal mappings to a path.

Classes

LiteralMapping(*, reference, predicate, ...)

A data model for literal mappings.

LiteralMappingTuple(text, curie, name, ...)

Represents rows in a spreadsheet.

Variables

DEFAULT_PREDICATE

The default synonym type predicate was chosen based on the OBO standard - when you don't specify a scope, this is what it infers

PREDICATES

A set of permissible predicates

GildaErrorPolicy

The error policy when converting to/from gilda terms

LiteralMappingIndex

An index from the reference to a list of mappings that use the reference

R

Type variable.

Writer

Valid writers

ssslm.io Package

I/O for SSSLM.

Functions

read_skos(-> list[~ssslm.model.LiteralMapping])

Read literal mappings from a SKOS.

ssslm.ner Module

NER utilities build on literal mappings.

Functions

make_grounder(...)

Get a grounder from literal mappings.

read_annotations(-> list[~ssslm.ner.Annotation])

Read annotations from a TSV file.

write_annotations(annotations, path)

Write annotations to a TSV file.

Classes

Annotation(*, text, start, end, match)

Data about an annotation.

Annotator()

An interface for something that can annotate.

GLiNERGrounder(matcher, *[, model, threshold])

An annotator that works via gliner.

GildaGrounder(grounder, *[, reference_cls])

A grounder and annotator that uses gilda as a backend.

GildaMatcher(grounder, *[, reference_cls])

A matcher that uses gilda as a backend.

Grounder()

A combine matcher and annotator.

Match(*, reference, score)

A match from NER.

Matcher()

An interface for a named entity normalizer.

PandasTargetType(*values)

How should pandas columns be filled.

SpacyGrounder(matcher, spacy_model)

An annotator that works via spacy.

WrappedMatcher(*, matcher)

A matcher that wraps another matcher, allowing for composition.

Variables

GLINER_DEFAULT

The default model used for GLiNER.

GrounderHint

A type for an object can be coerced into a SSSLM-backed grounder via make_grounder()

Class Inheritance Diagram

digraph inheritanced6536777ca { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ABC" [URL="https://docs.python.org/3/library/abc.html#abc.ABC",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Helper class that provides a standard way to create an ABC using"]; "Annotation" [URL="api/ssslm.ner.Annotation.html#ssslm.ner.Annotation",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Data about an annotation."]; "BaseModel" -> "Annotation" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Generic" -> "Annotation" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Annotator" [URL="api/ssslm.ner.Annotator.html#ssslm.ner.Annotator",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="An interface for something that can annotate."]; "ABC" -> "Annotator" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Generic" -> "Annotator" [arrowsize=0.5,style="setlinewidth(0.5)"]; "BaseModel" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="!!! abstract \"Usage Documentation\""]; "Enum" [URL="https://docs.python.org/3/library/enum.html#enum.Enum",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Create a collection of name/value pairs."]; "GLiNERGrounder" [URL="api/ssslm.ner.GLiNERGrounder.html#ssslm.ner.GLiNERGrounder",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="An annotator that works via :mod:`gliner`."]; "Grounder" -> "GLiNERGrounder" [arrowsize=0.5,style="setlinewidth(0.5)"]; "WrappedMatcher" -> "GLiNERGrounder" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Generic" -> "GLiNERGrounder" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Generic" [URL="https://docs.python.org/3/library/typing.html#typing.Generic",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Abstract base class for generic types."]; "GildaGrounder" [URL="api/ssslm.ner.GildaGrounder.html#ssslm.ner.GildaGrounder",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A grounder and annotator that uses gilda as a backend."]; "Grounder" -> "GildaGrounder" [arrowsize=0.5,style="setlinewidth(0.5)"]; "GildaMatcher" -> "GildaGrounder" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Generic" -> "GildaGrounder" [arrowsize=0.5,style="setlinewidth(0.5)"]; "GildaMatcher" [URL="api/ssslm.ner.GildaMatcher.html#ssslm.ner.GildaMatcher",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A matcher that uses gilda as a backend."]; "Matcher" -> "GildaMatcher" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Generic" -> "GildaMatcher" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Grounder" [URL="api/ssslm.ner.Grounder.html#ssslm.ner.Grounder",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A combine matcher and annotator."]; "Matcher" -> "Grounder" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Annotator" -> "Grounder" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ABC" -> "Grounder" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Generic" -> "Grounder" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Match" [URL="api/ssslm.ner.Match.html#ssslm.ner.Match",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A match from NER."]; "BaseModel" -> "Match" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Generic" -> "Match" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Matcher" [URL="api/ssslm.ner.Matcher.html#ssslm.ner.Matcher",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="An interface for a named entity normalizer."]; "ABC" -> "Matcher" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Generic" -> "Matcher" [arrowsize=0.5,style="setlinewidth(0.5)"]; "PandasTargetType" [URL="api/ssslm.ner.PandasTargetType.html#ssslm.ner.PandasTargetType",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="How should pandas columns be filled."]; "Enum" -> "PandasTargetType" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SpacyGrounder" [URL="api/ssslm.ner.SpacyGrounder.html#ssslm.ner.SpacyGrounder",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="An annotator that works via spacy."]; "Grounder" -> "SpacyGrounder" [arrowsize=0.5,style="setlinewidth(0.5)"]; "WrappedMatcher" -> "SpacyGrounder" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Generic" -> "SpacyGrounder" [arrowsize=0.5,style="setlinewidth(0.5)"]; "WrappedMatcher" [URL="api/ssslm.ner.WrappedMatcher.html#ssslm.ner.WrappedMatcher",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A matcher that wraps another matcher, allowing for composition."]; "Matcher" -> "WrappedMatcher" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Generic" -> "WrappedMatcher" [arrowsize=0.5,style="setlinewidth(0.5)"]; }