glazing.references.mapper¶
Mapping between dataset identifiers.
mapper
¶
Role alignment and concept mapping across linguistic datasets.
This module provides functionality for aligning semantic roles, mapping concepts, and calculating similarity between entities across FrameNet, PropBank, VerbNet, and WordNet.
| CLASS | DESCRIPTION |
|---|---|
ReferenceMapper |
Main class for role alignment and concept mapping. |
Notes
The mapper uses various alignment strategies including direct mappings, syntactic position matching, and semantic similarity measures to establish correspondences between dataset elements.
Classes¶
ReferenceMapper()
¶
Map roles and concepts across linguistic datasets.
This class provides algorithms for aligning semantic roles between datasets, unifying concepts, and calculating similarity scores.
| ATTRIBUTE | DESCRIPTION |
|---|---|
role_alignments |
Unified role mappings indexed by concept name.
TYPE:
|
concept_alignments |
Concept alignments indexed by concept name.
TYPE:
|
role_mapping_tables |
Pre-defined role mapping tables.
TYPE:
|
| METHOD | DESCRIPTION |
|---|---|
align_roles |
Align a VerbNet role with FrameNet FEs and PropBank arguments. |
map_concepts |
Create unified concept mapping across datasets. |
calculate_similarity |
Calculate semantic similarity between entities. |
build_alignment_matrix |
Build confidence matrix for entity alignments. |
get_unified_lemma |
Get unified representation of a lemma across datasets. |
Initialize the reference mapper.
Source code in src/glazing/references/mapper.py
Functions¶
align_roles(verbnet_role: ThematicRole, verbnet_class: VerbClass, framenet_frame: Frame | None = None, propbank_roleset: Roleset | None = None) -> UnifiedRoleMapping
¶
Align a VerbNet role with FrameNet FEs and PropBank arguments.
Uses multiple strategies including direct mappings, syntactic position, and semantic similarity to establish alignments.
| PARAMETER | DESCRIPTION |
|---|---|
verbnet_role
|
VerbNet thematic role to align.
TYPE:
|
verbnet_class
|
VerbNet class containing the role.
TYPE:
|
framenet_frame
|
FrameNet frame to align with.
TYPE:
|
propbank_roleset
|
PropBank roleset to align with.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
UnifiedRoleMapping
|
Unified mapping for the role across datasets. |
Source code in src/glazing/references/mapper.py
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | |
build_alignment_matrix(entities1: list[str], dataset1: DatasetType, entities2: list[str], dataset2: DatasetType) -> dict[str, dict[str, float]]
¶
Build confidence matrix for entity alignments.
Creates a matrix of similarity scores between all pairs of entities from two datasets.
| PARAMETER | DESCRIPTION |
|---|---|
entities1
|
Entities from first dataset.
TYPE:
|
dataset1
|
First dataset type.
TYPE:
|
entities2
|
Entities from second dataset.
TYPE:
|
dataset2
|
Second dataset type.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict[str, dict[str, float]]
|
Nested dict mapping entity1 -> entity2 -> confidence. |
Source code in src/glazing/references/mapper.py
calculate_similarity(entity1: str, dataset1: DatasetType, entity2: str, dataset2: DatasetType) -> float
¶
Calculate semantic similarity between entities.
Uses various heuristics to estimate similarity between entities from different datasets.
| PARAMETER | DESCRIPTION |
|---|---|
entity1
|
First entity ID.
TYPE:
|
dataset1
|
First entity's dataset.
TYPE:
|
entity2
|
Second entity ID.
TYPE:
|
dataset2
|
Second entity's dataset.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
float
|
Similarity score (0.0-1.0). |
Source code in src/glazing/references/mapper.py
get_unified_lemma(lemma: str, pos: str, framenet_lus: list[str] | None = None, propbank_rolesets: list[str] | None = None, verbnet_members: list[str] | None = None, wordnet_senses: list[Sense] | None = None) -> UnifiedLemma
¶
Get unified representation of a lemma across datasets.
Creates a unified view of how a lemma is represented in each linguistic dataset.
| PARAMETER | DESCRIPTION |
|---|---|
lemma
|
The lemma to unify.
TYPE:
|
pos
|
Part of speech.
TYPE:
|
framenet_lus
|
FrameNet lexical unit IDs.
TYPE:
|
propbank_rolesets
|
PropBank roleset IDs.
TYPE:
|
verbnet_members
|
VerbNet member keys.
TYPE:
|
wordnet_senses
|
WordNet senses.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
UnifiedLemma
|
Unified lemma representation. |
Source code in src/glazing/references/mapper.py
map_concepts(concept_name: str, framenet_frames: list[str] | None = None, propbank_rolesets: list[str] | None = None, verbnet_classes: list[str] | None = None, wordnet_synsets: list[str] | None = None) -> ConceptAlignment
¶
Create unified concept mapping across datasets.
Maps a semantic concept to its representations in each dataset.
| PARAMETER | DESCRIPTION |
|---|---|
concept_name
|
Name of the semantic concept.
TYPE:
|
framenet_frames
|
FrameNet frames representing the concept.
TYPE:
|
propbank_rolesets
|
PropBank rolesets representing the concept.
TYPE:
|
verbnet_classes
|
VerbNet classes representing the concept.
TYPE:
|
wordnet_synsets
|
WordNet synset offsets representing the concept.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ConceptAlignment
|
Unified concept alignment. |