Skip to content

glazing.references.models

Reference data models.

models

Cross-reference models for mapping between linguistic datasets.

This module provides models for managing cross-references between FrameNet, PropBank, VerbNet, and WordNet. It includes confidence scoring, transitive mapping resolution, and unified representations across datasets.

CLASS DESCRIPTION
MappingMetadata

Metadata for cross-dataset mappings.

MappingConfidence

Confidence scoring for mappings.

CrossReference

Base mapping between entities in different datasets.

MultiMapping

One-to-many mapping with ranked alternatives.

TransitiveMapping

Indirect mapping through intermediate resources.

VerbNetFrameNetMapping

VerbNet to FrameNet mapping with confidence.

VerbNetFrameNetRoleMapping

Role-level mapping between VerbNet and FrameNet.

VerbNetCrossRefs

VerbNet member cross-references.

PropBankCrossRefs

PropBank roleset cross-references with confidence.

PropBankRoleMapping

PropBank role to other dataset role mapping.

UnifiedRoleMapping

Complete role mapping across all datasets.

UnifiedLemma

A lemma with all its representations across datasets.

ConceptAlignment

Alignment of semantic concepts across datasets.

RoleMappingTable

Maps roles across different datasets.

FEAlignment

Cross-dataset FE alignment with full metadata.

FEInheritanceChain

Tracks FE inheritance through frame hierarchy.

MappingConflict

Represents a conflict in cross-dataset mappings.

MappingIndex

Bidirectional index for fast mapping lookups.

Notes

All confidence scores are normalized to 0.0-1.0 range. Transitive mappings propagate confidence through the chain.

Classes

ConceptAlignment pydantic-model

Bases: BaseModel

Alignment of semantic concepts across datasets.

ATTRIBUTE DESCRIPTION
concept_name

Name of the semantic concept.

TYPE: str

concept_type

Type of concept (e.g., "frame", "event").

TYPE: str

framenet_frames

Related FrameNet frames.

TYPE: list[str]

propbank_rolesets

Related PropBank rolesets.

TYPE: list[str]

verbnet_classes

Related VerbNet classes.

TYPE: list[str]

wordnet_synsets

Related WordNet synsets.

TYPE: list[SynsetOffset]

confidence

Overall alignment confidence.

TYPE: float | None

alignment_method

Method used for alignment.

TYPE: str

alignment_criteria

Criteria used for alignment.

TYPE: list[str]

Fields:

  • concept_name (str)
  • concept_type (str)
  • framenet_frames (list[str])
  • propbank_rolesets (list[str])
  • verbnet_classes (list[str])
  • wordnet_synsets (list[SynsetOffset])
  • confidence (float | None)
  • alignment_method (str)
  • alignment_criteria (list[str])

CrossReference pydantic-model

Bases: BaseModel

Cross-dataset reference with full metadata.

ATTRIBUTE DESCRIPTION
source_dataset

Source dataset name.

TYPE: DatasetType

source_id

Identifier in source dataset.

TYPE: str

source_version

Version of source dataset.

TYPE: str

target_dataset

Target dataset name.

TYPE: DatasetType

target_id

Identifier(s) in target dataset.

TYPE: str | list[str]

mapping_type

Type of mapping relationship.

TYPE: MappingType

confidence

Confidence scoring for the mapping.

TYPE: MappingConfidence | None

metadata

Metadata about the mapping.

TYPE: MappingMetadata

inherited_from

For mappings inherited from parent classes.

TYPE: str | None

Fields:

  • source_dataset (DatasetType)
  • source_id (str)
  • source_version (str)
  • target_dataset (DatasetType)
  • target_id (str | list[str])
  • mapping_type (MappingType)
  • confidence (MappingConfidence | None)
  • metadata (MappingMetadata)
  • inherited_from (str | None)

FEAlignment pydantic-model

Bases: BaseModel

Cross-dataset FE alignment with full metadata.

ATTRIBUTE DESCRIPTION
source_frame

FrameNet frame name.

TYPE: str

source_fe

FrameNet FE name.

TYPE: str

target_dataset

Target dataset.

TYPE: DatasetType

target_role

Target role/arg name.

TYPE: str

alignment_type

Type of alignment.

TYPE: AlignmentType

confidence

Confidence scoring.

TYPE: MappingConfidence

evidence

Supporting evidence for alignment.

TYPE: list[str]

Fields:

  • source_frame (str)
  • source_fe (str)
  • target_dataset (DatasetType)
  • target_role (str)
  • alignment_type (AlignmentType)
  • confidence (MappingConfidence)
  • evidence (list[str])
Functions
get_combined_score() -> float

Get combined alignment score.

RETURNS DESCRIPTION
float

Adjusted confidence score based on alignment type.

Source code in src/glazing/references/models.py
def get_combined_score(self) -> float:
    """Get combined alignment score.

    Returns
    -------
    float
        Adjusted confidence score based on alignment type.
    """
    base_score = self.confidence.score
    if self.alignment_type == "inherited":
        base_score *= 0.9
    elif self.alignment_type == "inferred":
        base_score *= 0.8
    elif self.alignment_type == "partial":
        base_score *= 0.7
    return base_score

FEInheritanceChain pydantic-model

Bases: BaseModel

Tracks FE inheritance through frame hierarchy.

ATTRIBUTE DESCRIPTION
fe_name

Frame element name.

TYPE: str

frame_chain

Frames from child to parent.

TYPE: list[str]

inheritance_path

Chain of FE relations.

TYPE: list[FERelation]

final_mapping

Final cross-dataset mapping.

TYPE: FEAlignment | None

Fields:

  • fe_name (str)
  • frame_chain (list[str])
  • inheritance_path (list[FERelation])
  • final_mapping (FEAlignment | None)
Functions
get_inheritance_depth() -> int

Get depth of inheritance chain.

RETURNS DESCRIPTION
int

Number of inheritance steps.

Source code in src/glazing/references/models.py
def get_inheritance_depth(self) -> int:
    """Get depth of inheritance chain.

    Returns
    -------
    int
        Number of inheritance steps.
    """
    return len(self.frame_chain) - 1

FERelation pydantic-model

Bases: BaseModel

FE mapping between related frames with alignment metadata.

ATTRIBUTE DESCRIPTION
sub_fe_id

Sub-frame FE ID.

TYPE: int | None

sub_fe_name

Sub-frame FE name.

TYPE: str | None

super_fe_id

Super-frame FE ID.

TYPE: int | None

super_fe_name

Super-frame FE name.

TYPE: str | None

relation_type

Type of relation.

TYPE: str | None

alignment_confidence

Alignment confidence score.

TYPE: float | None

semantic_similarity

Semantic similarity score.

TYPE: float | None

syntactic_similarity

Syntactic similarity score.

TYPE: float | None

mapping_notes

Notes about the mapping.

TYPE: str | None

Fields:

  • sub_fe_id (int | None)
  • sub_fe_name (str | None)
  • super_fe_id (int | None)
  • super_fe_name (str | None)
  • relation_type (str | None)
  • alignment_confidence (float | None)
  • semantic_similarity (float | None)
  • syntactic_similarity (float | None)
  • mapping_notes (str | None)

Validators:

Functions
is_equivalence() -> bool

Check if FEs are equivalent.

RETURNS DESCRIPTION
bool

True if relation type is equivalence.

Source code in src/glazing/references/models.py
def is_equivalence(self) -> bool:
    """Check if FEs are equivalent.

    Returns
    -------
    bool
        True if relation type is equivalence.
    """
    return self.relation_type == "Equivalence"
is_inheritance() -> bool

Check if this is an inheritance relation.

RETURNS DESCRIPTION
bool

True if relation type is inheritance.

Source code in src/glazing/references/models.py
def is_inheritance(self) -> bool:
    """Check if this is an inheritance relation.

    Returns
    -------
    bool
        True if relation type is inheritance.
    """
    return self.relation_type == "Inheritance"
validate_fe_names(v: str | None) -> str | None pydantic-validator

Validate FE name format.

PARAMETER DESCRIPTION
v

FE name to validate.

TYPE: str | None

RETURNS DESCRIPTION
str | None

Validated FE name.

RAISES DESCRIPTION
ValueError

If FE name format is invalid.

Source code in src/glazing/references/models.py
@field_validator("sub_fe_name", "super_fe_name")
@classmethod
def validate_fe_names(cls, v: str | None) -> str | None:
    """Validate FE name format.

    Parameters
    ----------
    v : str | None
        FE name to validate.

    Returns
    -------
    str | None
        Validated FE name.

    Raises
    ------
    ValueError
        If FE name format is invalid.
    """
    if v and not re.match(r"^[A-Z][A-Za-z0-9_]*$", v):
        msg = f"Invalid FE name format: {v}"
        raise ValueError(msg)
    return v

FrameNetLURef pydantic-model

Bases: BaseModel

Reference to a FrameNet lexical unit.

ATTRIBUTE DESCRIPTION
lu_id

Lexical unit ID.

TYPE: int

frame_name

Frame that contains this LU.

TYPE: str

definition

LU definition.

TYPE: str

Fields:

  • lu_id (int)
  • frame_name (str)
  • definition (str)

MappingConfidence pydantic-model

Bases: BaseModel

Confidence scoring for mappings.

ATTRIBUTE DESCRIPTION
score

Confidence score between 0.0 and 1.0.

TYPE: float

method

Method used to calculate confidence.

TYPE: str

factors

Component scores contributing to overall confidence.

TYPE: dict[str, float]

RAISES DESCRIPTION
ValueError

If score is not between 0.0 and 1.0.

Fields:

  • score (float)
  • method (str)
  • factors (dict[str, float])

Validators:

Functions
validate_score(v: float) -> float pydantic-validator

Validate confidence score is in valid range.

PARAMETER DESCRIPTION
v

Score to validate.

TYPE: float

RETURNS DESCRIPTION
float

Validated score.

RAISES DESCRIPTION
ValueError

If score is not between 0.0 and 1.0.

Source code in src/glazing/references/models.py
@field_validator("score")
@classmethod
def validate_score(cls, v: float) -> float:
    """Validate confidence score is in valid range.

    Parameters
    ----------
    v : float
        Score to validate.

    Returns
    -------
    float
        Validated score.

    Raises
    ------
    ValueError
        If score is not between 0.0 and 1.0.
    """
    if not 0.0 <= v <= 1.0:
        msg = f"Confidence score must be between 0 and 1: {v}"
        raise ValueError(msg)
    return v

MappingConflict pydantic-model

Bases: BaseModel

Represents a conflict in cross-dataset mappings.

ATTRIBUTE DESCRIPTION
conflict_type

Type of conflict.

TYPE: ConflictType

source_dataset

Source dataset.

TYPE: DatasetType

source_id

Source identifier.

TYPE: str

conflicting_mappings

Conflicting mapping alternatives.

TYPE: list[CrossReference]

resolution_strategy

Strategy used to resolve conflict.

TYPE: str | None

resolved_mapping

Resolved mapping after conflict resolution.

TYPE: CrossReference | None

Fields:

  • conflict_type (ConflictType)
  • source_dataset (DatasetType)
  • source_id (str)
  • conflicting_mappings (list[CrossReference])
  • resolution_strategy (str | None)
  • resolved_mapping (CrossReference | None)
Functions
resolve_by_confidence() -> CrossReference | None

Resolve conflict by selecting highest confidence mapping.

RETURNS DESCRIPTION
CrossReference | None

Highest confidence mapping or None.

Source code in src/glazing/references/models.py
def resolve_by_confidence(self) -> CrossReference | None:
    """Resolve conflict by selecting highest confidence mapping.

    Returns
    -------
    CrossReference | None
        Highest confidence mapping or None.
    """
    if not self.conflicting_mappings:
        return None
    return max(
        self.conflicting_mappings, key=lambda m: m.confidence.score if m.confidence else 0.0
    )
resolve_by_source(preferred_source: MappingSource) -> CrossReference | None

Resolve by preferring specific mapping source.

PARAMETER DESCRIPTION
preferred_source

Preferred source for resolution.

TYPE: MappingSource

RETURNS DESCRIPTION
CrossReference | None

Mapping from preferred source or None.

Source code in src/glazing/references/models.py
def resolve_by_source(self, preferred_source: MappingSource) -> CrossReference | None:
    """Resolve by preferring specific mapping source.

    Parameters
    ----------
    preferred_source : MappingSource
        Preferred source for resolution.

    Returns
    -------
    CrossReference | None
        Mapping from preferred source or None.
    """
    for mapping in self.conflicting_mappings:
        if mapping.metadata.created_by == preferred_source:
            return mapping
    return None

MappingIndex pydantic-model

Bases: BaseModel

Bidirectional index for fast mapping lookups.

ATTRIBUTE DESCRIPTION
forward_index

Source to target mappings.

TYPE: dict[str, list[CrossReference]]

reverse_index

Target to source mappings.

TYPE: dict[str, list[CrossReference]]

transitive_cache

Cached transitive mappings.

TYPE: dict[tuple[str, str], list[TransitiveMapping]]

Fields:

Functions
add_mapping(mapping: CrossReference) -> None

Add mapping to bidirectional index.

PARAMETER DESCRIPTION
mapping

Mapping to add to index.

TYPE: CrossReference

Source code in src/glazing/references/models.py
def add_mapping(self, mapping: CrossReference) -> None:
    """Add mapping to bidirectional index.

    Parameters
    ----------
    mapping : CrossReference
        Mapping to add to index.
    """
    # Forward index
    key = f"{mapping.source_dataset}:{mapping.source_id}"
    if key not in self.forward_index:
        self.forward_index[key] = []
    self.forward_index[key].append(mapping)

    # Reverse index
    targets = mapping.target_id if isinstance(mapping.target_id, list) else [mapping.target_id]
    for target in targets:
        key = f"{mapping.target_dataset}:{target}"
        if key not in self.reverse_index:
            self.reverse_index[key] = []
        self.reverse_index[key].append(mapping)
find_transitive_mappings(source: str, target_dataset: DatasetType, max_hops: int = 3) -> list[TransitiveMapping]

Find indirect mappings through intermediate resources.

PARAMETER DESCRIPTION
source

Source identifier.

TYPE: str

target_dataset

Target dataset.

TYPE: DatasetType

max_hops

Maximum number of intermediate steps.

TYPE: int DEFAULT: 3

RETURNS DESCRIPTION
list[TransitiveMapping]

Found transitive mappings.

Source code in src/glazing/references/models.py
def find_transitive_mappings(
    self, source: str, target_dataset: DatasetType, max_hops: int = 3
) -> list[TransitiveMapping]:
    """Find indirect mappings through intermediate resources.

    Parameters
    ----------
    source : str
        Source identifier.
    target_dataset : DatasetType
        Target dataset.
    max_hops : int
        Maximum number of intermediate steps.

    Returns
    -------
    list[TransitiveMapping]
        Found transitive mappings.
    """
    cache_key = (source, target_dataset, max_hops)
    if cache_key in self.transitive_cache:
        return self.transitive_cache[cache_key]

    mappings = self._search_transitive_mappings(source, target_dataset, max_hops)
    mappings.sort(key=lambda m: m.combined_confidence, reverse=True)

    self.transitive_cache[cache_key] = mappings
    return mappings

MappingMetadata pydantic-model

Bases: BaseModel

Metadata for cross-dataset mappings.

ATTRIBUTE DESCRIPTION
created_date

When the mapping was created.

TYPE: datetime

created_by

Person or system that created mapping.

TYPE: str

modified_date

When the mapping was last modified.

TYPE: datetime | None

modified_by

Person or system that last modified mapping.

TYPE: str | None

version

Dataset version this mapping was created for.

TYPE: str

validation_status

Current validation status of the mapping.

TYPE: ValidationStatus

validation_method

How the mapping was validated.

TYPE: str | None

notes

Additional notes about the mapping.

TYPE: str | None

Fields:

  • created_date (datetime)
  • created_by (str)
  • modified_date (datetime | None)
  • modified_by (str | None)
  • version (str)
  • validation_status (ValidationStatus)
  • validation_method (str | None)
  • notes (str | None)

MultiMapping pydantic-model

Bases: BaseModel

One-to-many mapping with ranked alternatives.

ATTRIBUTE DESCRIPTION
source_dataset

Source dataset name.

TYPE: DatasetType

source_id

Identifier in source dataset.

TYPE: str

source_version

Version of source dataset.

TYPE: str

mappings

Ordered list of mappings by confidence.

TYPE: list[CrossReference]

primary_mapping

Highest confidence or manually selected mapping.

TYPE: CrossReference | None

conflict_resolution

How conflicts were resolved.

TYPE: str | None

Fields:

  • source_dataset (DatasetType)
  • source_id (str)
  • source_version (str)
  • mappings (list[CrossReference])
  • primary_mapping (CrossReference | None)
  • conflict_resolution (str | None)
Functions
get_best_mapping(target_dataset: DatasetType) -> CrossReference | None

Get highest confidence mapping to target dataset.

PARAMETER DESCRIPTION
target_dataset

Target dataset to find mapping for.

TYPE: DatasetType

RETURNS DESCRIPTION
CrossReference | None

Highest confidence mapping or None if not found.

Source code in src/glazing/references/models.py
def get_best_mapping(self, target_dataset: DatasetType) -> CrossReference | None:
    """Get highest confidence mapping to target dataset.

    Parameters
    ----------
    target_dataset : DatasetType
        Target dataset to find mapping for.

    Returns
    -------
    CrossReference | None
        Highest confidence mapping or None if not found.
    """
    candidates = [m for m in self.mappings if m.target_dataset == target_dataset]
    if not candidates:
        return None
    return max(candidates, key=lambda m: m.confidence.score if m.confidence else 0.0)

PropBankCrossRefs pydantic-model

Bases: BaseModel

PropBank roleset cross-references with confidence.

ATTRIBUTE DESCRIPTION
roleset_id

PropBank roleset identifier.

TYPE: str

rolelinks

Direct role-level mappings.

TYPE: list[RoleLink]

lexlinks

Lexical links with confidence scores.

TYPE: list[LexLink]

wn_mappings

WordNet mappings if available.

TYPE: list[WordNetCrossRef]

Fields:

Functions
get_verbnet_classes() -> list[tuple[str, float | None]]

Get VerbNet classes with optional confidence.

RETURNS DESCRIPTION
list[tuple[str, float | None]]

VerbNet class names with confidence scores.

Source code in src/glazing/references/models.py
def get_verbnet_classes(self) -> list[tuple[str, float | None]]:
    """Get VerbNet classes with optional confidence.

    Returns
    -------
    list[tuple[str, float | None]]
        VerbNet class names with confidence scores.
    """
    vn_classes: list[tuple[str, float | None]] = []
    # From rolelinks (no confidence)
    for rl in self.rolelinks:
        if rl.resource == "verbnet":
            vn_classes.append((rl.class_name, None))
    # From lexlinks (with confidence)
    for ll in self.lexlinks:
        if ll.resource == "verbnet":
            vn_classes.append((ll.class_name, ll.confidence))
    return vn_classes
get_wordnet_senses() -> list[WordNetCrossRef]

Get WordNet senses for this roleset.

RETURNS DESCRIPTION
list[WordNetCrossRef]

WordNet cross-references.

Source code in src/glazing/references/models.py
def get_wordnet_senses(self) -> list[WordNetCrossRef]:
    """Get WordNet senses for this roleset.

    Returns
    -------
    list[WordNetCrossRef]
        WordNet cross-references.
    """
    return self.wn_mappings

PropBankRoleMapping pydantic-model

Bases: BaseModel

PropBank role to other dataset role mapping.

ATTRIBUTE DESCRIPTION
pb_arg

PropBank argument (e.g., "ARG0").

TYPE: str

target_dataset

Target dataset name.

TYPE: DatasetType

target_role

Target role/FE name.

TYPE: str

confidence

Confidence scoring for the mapping.

TYPE: MappingConfidence | None

mapping_source

Source of the mapping.

TYPE: MappingSource

Fields:

  • pb_arg (str)
  • target_dataset (DatasetType)
  • target_role (str)
  • confidence (MappingConfidence | None)
  • mapping_source (MappingSource)

PropBankRolesetRef pydantic-model

Bases: BaseModel

Reference to a PropBank roleset.

ATTRIBUTE DESCRIPTION
roleset_id

Roleset identifier.

TYPE: str

name

Descriptive name.

TYPE: str | None

Fields:

  • roleset_id (str)
  • name (str | None)

RoleMappingTable pydantic-model

Bases: BaseModel

Maps roles across different datasets.

ATTRIBUTE DESCRIPTION
verbnet_role

VerbNet thematic role.

TYPE: str

framenet_fe

Corresponding FrameNet FE.

TYPE: str | None

propbank_arg

Corresponding PropBank argument.

TYPE: str | None

wordnet_semantic_role

Inferred WordNet semantic role.

TYPE: str | None

mapping_notes

Notes about the mapping.

TYPE: str

Fields:

  • verbnet_role (str)
  • framenet_fe (str | None)
  • propbank_arg (str | None)
  • wordnet_semantic_role (str | None)
  • mapping_notes (str)
Functions
is_agentive() -> bool

Check if this represents an agentive role.

RETURNS DESCRIPTION
bool

True if role is agentive.

Source code in src/glazing/references/models.py
def is_agentive(self) -> bool:
    """Check if this represents an agentive role.

    Returns
    -------
    bool
        True if role is agentive.
    """
    agentive_roles = {"Agent", "ARG0", "Actor", "Causer"}
    return bool(
        self.verbnet_role in agentive_roles
        or self.propbank_arg == "ARG0"
        or (self.framenet_fe and "Agent" in self.framenet_fe)
    )

TransitiveMapping pydantic-model

Bases: BaseModel

Indirect mapping through intermediate resource.

ATTRIBUTE DESCRIPTION
source_dataset

Source dataset name.

TYPE: DatasetType

source_id

Identifier in source dataset.

TYPE: str

target_dataset

Target dataset name.

TYPE: DatasetType

target_id

Identifier in target dataset.

TYPE: str

path

Chain of mappings from source to target.

TYPE: list[CrossReference]

combined_confidence

Propagated confidence through chain.

TYPE: float

Fields:

  • source_dataset (DatasetType)
  • source_id (str)
  • target_dataset (DatasetType)
  • target_id (str)
  • path (list[CrossReference])
  • combined_confidence (float)
Functions
calculate_confidence() -> float

Calculate combined confidence through chain.

RETURNS DESCRIPTION
float

Combined confidence score.

Source code in src/glazing/references/models.py
def calculate_confidence(self) -> float:
    """Calculate combined confidence through chain.

    Returns
    -------
    float
        Combined confidence score.
    """
    if not self.path:
        return 0.0
    scores = [m.confidence.score for m in self.path if m.confidence]
    if not scores:
        return 0.0
    # Multiply confidences (assuming independence)
    result = 1.0
    for score in scores:
        result *= score
    return result

UnifiedLemma pydantic-model

Bases: BaseModel

A lemma with all its representations across datasets.

ATTRIBUTE DESCRIPTION
lemma

Base lemma form.

TYPE: str

pos

Unified part of speech.

TYPE: Literal[...]

framenet_lus

FrameNet lexical units.

TYPE: list[FrameNetLURef]

propbank_rolesets

PropBank rolesets.

TYPE: list[PropBankRolesetRef]

verbnet_members

VerbNet members with class membership.

TYPE: list[VerbNetMemberRef]

wordnet_senses

WordNet senses.

TYPE: list[Sense]

Fields:

Validators:

Functions
validate_lemma(v: str) -> str pydantic-validator

Validate lemma format.

PARAMETER DESCRIPTION
v

Lemma to validate.

TYPE: str

RETURNS DESCRIPTION
str

Validated lemma.

RAISES DESCRIPTION
ValueError

If lemma format is invalid.

Source code in src/glazing/references/models.py
@field_validator("lemma")
@classmethod
def validate_lemma(cls, v: str) -> str:
    """Validate lemma format.

    Parameters
    ----------
    v : str
        Lemma to validate.

    Returns
    -------
    str
        Validated lemma.

    Raises
    ------
    ValueError
        If lemma format is invalid.
    """
    if not re.match(LEMMA_PATTERN, v):
        msg = f"Invalid lemma format: {v!r}"
        raise ValueError(msg)
    return v

UnifiedRoleMapping pydantic-model

Bases: BaseModel

Complete role mapping across all datasets.

ATTRIBUTE DESCRIPTION
concept

Semantic concept (e.g., "agent", "patient").

TYPE: str

verbnet_roles

VerbNet (class_id, role) pairs.

TYPE: list[tuple[str, str]]

framenet_fes

FrameNet (frame, fe) pairs.

TYPE: list[tuple[str, str]]

propbank_args

PropBank (roleset, arg) pairs.

TYPE: list[tuple[str, str]]

wordnet_restrictions

Inferred semantic restrictions from WordNet.

TYPE: list[str]

confidence_matrix

Pairwise confidence scores between mappings.

TYPE: dict[str, dict[str, float]]

Fields:

  • concept (str)
  • verbnet_roles (list[tuple[str, str]])
  • framenet_fes (list[tuple[str, str]])
  • propbank_args (list[tuple[str, str]])
  • wordnet_restrictions (list[str])
  • confidence_matrix (dict[str, dict[str, float]])
Functions
get_alignment_score() -> float

Calculate overall alignment score.

RETURNS DESCRIPTION
float

Average confidence across all pairwise mappings.

Source code in src/glazing/references/models.py
def get_alignment_score(self) -> float:
    """Calculate overall alignment score.

    Returns
    -------
    float
        Average confidence across all pairwise mappings.
    """
    if not self.confidence_matrix:
        return 0.0
    scores: list[float] = []
    for source in self.confidence_matrix.values():
        scores.extend(source.values())
    return sum(scores) / len(scores) if scores else 0.0

VerbNetCrossRefs pydantic-model

Bases: BaseModel

VerbNet member cross-references.

ATTRIBUTE DESCRIPTION
verbnet_key

Unique identifier for VerbNet member.

TYPE: str

class_id

VerbNet class this belongs to.

TYPE: str

lemma

Base form of the verb.

TYPE: str

fn_mappings

Multi-way FrameNet mappings with confidence.

TYPE: list[VerbNetFrameNetMapping]

pb_groupings

PropBank senses.

TYPE: list[str]

wn_mappings

WordNet mappings with metadata.

TYPE: list[WordNetCrossRef]

inherited_mappings

Inherited mappings from parent classes.

TYPE: list[CrossReference]

Fields:

Functions
get_primary_framenet_mapping() -> VerbNetFrameNetMapping | None

Get highest confidence FrameNet mapping.

RETURNS DESCRIPTION
VerbNetFrameNetMapping | None

Highest confidence mapping or None if not found.

Source code in src/glazing/references/models.py
def get_primary_framenet_mapping(self) -> VerbNetFrameNetMapping | None:
    """Get highest confidence FrameNet mapping.

    Returns
    -------
    VerbNetFrameNetMapping | None
        Highest confidence mapping or None if not found.
    """
    if not self.fn_mappings:
        return None
    return max(self.fn_mappings, key=lambda m: m.confidence.score if m.confidence else 0.0)
has_conflicting_mappings() -> bool

Check if there are conflicting FrameNet mappings.

RETURNS DESCRIPTION
bool

True if multiple high-confidence mappings exist.

Source code in src/glazing/references/models.py
def has_conflicting_mappings(self) -> bool:
    """Check if there are conflicting FrameNet mappings.

    Returns
    -------
    bool
        True if multiple high-confidence mappings exist.
    """
    if len(self.fn_mappings) <= 1:
        return False
    # Check if multiple mappings have high confidence
    high_conf = [m for m in self.fn_mappings if m.confidence and m.confidence.score > 0.7]
    return len(high_conf) > 1

VerbNetFrameNetMapping pydantic-model

Bases: BaseModel

VerbNet to FrameNet mapping with confidence.

ATTRIBUTE DESCRIPTION
frame_name

FrameNet frame name.

TYPE: str

confidence

Confidence score for the mapping.

TYPE: MappingConfidence | None

mapping_source

Source of the mapping.

TYPE: MappingSource

role_mappings

Role-level mappings between VerbNet and FrameNet.

TYPE: list[VerbNetFrameNetRoleMapping]

Fields:

VerbNetFrameNetRoleMapping pydantic-model

Bases: BaseModel

Role-level mapping between VerbNet and FrameNet.

ATTRIBUTE DESCRIPTION
vn_role

VerbNet thematic role.

TYPE: str

fn_fe

FrameNet frame element.

TYPE: str

confidence

Confidence score for the role mapping.

TYPE: float | None

notes

Additional notes about the mapping.

TYPE: str | None

Fields:

  • vn_role (str)
  • fn_fe (str)
  • confidence (float | None)
  • notes (str | None)

VerbNetMemberRef pydantic-model

Bases: BaseModel

Reference to a VerbNet member.

ATTRIBUTE DESCRIPTION
verbnet_key

Unique member identifier.

TYPE: str

class_id

VerbNet class ID.

TYPE: str

Fields:

  • verbnet_key (str)
  • class_id (str)