glazing.references.resolver¶
Resolving cross-references.
resolver
¶
Reference resolution and validation for linguistic datasets.
This module provides functionality to validate cross-references, resolve transitive mappings through intermediate datasets, and handle inheritance chains in FrameNet and VerbNet.
| CLASS | DESCRIPTION |
|---|---|
ReferenceResolver |
Main class for validating and resolving cross-dataset references. |
Notes
The resolver handles transitive reference resolution by finding paths through intermediate datasets and propagating confidence scores along the path.
Classes¶
ReferenceResolver(mapping_index: MappingIndex | None = None)
¶
Validate and resolve cross-references between linguistic datasets.
This class provides methods to validate references against loaded datasets, resolve transitive mappings through intermediate resources, and handle inheritance relationships in VerbNet and FrameNet.
| ATTRIBUTE | DESCRIPTION |
|---|---|
mapping_index |
Index of all known mappings.
TYPE:
|
framenet_frames |
FrameNet frames indexed by name.
TYPE:
|
propbank_rolesets |
PropBank rolesets indexed by ID.
TYPE:
|
verbnet_classes |
VerbNet classes indexed by ID.
TYPE:
|
wordnet_synsets |
WordNet synsets indexed by offset.
TYPE:
|
wordnet_senses |
WordNet senses indexed by sense key.
TYPE:
|
| METHOD | DESCRIPTION |
|---|---|
set_datasets |
Set the datasets for validation. |
validate_reference |
Validate that a reference's target exists. |
resolve_transitive |
Find indirect mappings through intermediate datasets. |
resolve_verbnet_inheritance |
Resolve inherited mappings for a VerbNet member. |
resolve_framenet_fe_inheritance |
Resolve FE inheritance through frame relations. |
calculate_combined_confidence |
Calculate confidence for a transitive mapping path. |
detect_conflicts |
Detect conflicting mappings. |
Initialize the reference resolver.
| PARAMETER | DESCRIPTION |
|---|---|
mapping_index
|
Pre-existing mapping index to use.
TYPE:
|
Source code in src/glazing/references/resolver.py
Functions¶
calculate_combined_confidence(path: list[CrossReference]) -> float
¶
Calculate combined confidence for a transitive mapping path.
Multiplies confidence scores along the path, with a default penalty for mappings without confidence.
| PARAMETER | DESCRIPTION |
|---|---|
path
|
Sequence of mappings forming a path.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
float
|
Combined confidence score (0.0-1.0). |
Source code in src/glazing/references/resolver.py
detect_conflicts(mappings: list[CrossReference]) -> list[MappingConflict]
¶
Detect conflicting mappings.
Identifies cases where multiple high-confidence mappings point to different targets, or where mappings contradict each other.
| PARAMETER | DESCRIPTION |
|---|---|
mappings
|
Mappings to check for conflicts.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[MappingConflict]
|
Detected conflicts requiring resolution. |
Source code in src/glazing/references/resolver.py
resolve_framenet_fe_inheritance(frame: Frame, frame_relations: list[FrameRelation]) -> list[FEAlignment]
¶
Resolve FE inheritance through frame relations.
Traces FE mappings through inheritance relations to find alignments with parent frame FEs.
| PARAMETER | DESCRIPTION |
|---|---|
frame
|
FrameNet frame to resolve FE inheritance for.
TYPE:
|
frame_relations
|
Frame relations to trace through.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[FEAlignment]
|
FE alignments including inherited ones. |
Source code in src/glazing/references/resolver.py
resolve_transitive(source_id: str, source_dataset: DatasetType, target_dataset: DatasetType, max_hops: int = 3) -> list[TransitiveMapping]
¶
Find indirect mappings through intermediate datasets.
Uses breadth-first search to find all paths from source to target through intermediate datasets, up to max_hops in length.
| PARAMETER | DESCRIPTION |
|---|---|
source_id
|
Source entity ID.
TYPE:
|
source_dataset
|
Source dataset type.
TYPE:
|
target_dataset
|
Target dataset type.
TYPE:
|
max_hops
|
Maximum number of intermediate mappings.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[TransitiveMapping]
|
All transitive mapping paths found, sorted by confidence. |
Source code in src/glazing/references/resolver.py
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | |
resolve_verbnet_inheritance(member: Member, class_hierarchy: dict[str, VerbClass]) -> list[CrossReference]
¶
Resolve inherited mappings for a VerbNet member.
Traces through parent classes to find inherited mappings that aren't overridden in the member's class.
| PARAMETER | DESCRIPTION |
|---|---|
member
|
VerbNet member to resolve inheritance for.
TYPE:
|
class_hierarchy
|
All VerbNet classes indexed by ID.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[CrossReference]
|
Inherited mappings with metadata. |
Source code in src/glazing/references/resolver.py
305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 | |
set_datasets(framenet: list[Frame] | None = None, propbank: list[Frameset] | None = None, verbnet: list[VerbClass] | None = None, wordnet: tuple[list[Synset], list[Sense]] | None = None) -> None
¶
Set the datasets for validation.
| PARAMETER | DESCRIPTION |
|---|---|
framenet
|
FrameNet frames for validation.
TYPE:
|
propbank
|
PropBank framesets for validation.
TYPE:
|
verbnet
|
VerbNet classes for validation.
TYPE:
|
wordnet
|
WordNet synsets and senses for validation. |
Source code in src/glazing/references/resolver.py
trace_fe_inheritance_chain(fe_name: str, frame_name: str, frame_index: dict[str, Frame]) -> FEInheritanceChain
¶
Trace FE inheritance through frame hierarchy.
Follows inheritance relations to build a complete chain showing how an FE is inherited through parent frames.
| PARAMETER | DESCRIPTION |
|---|---|
fe_name
|
Frame element name to trace.
TYPE:
|
frame_name
|
Starting frame name.
TYPE:
|
frame_index
|
All frames indexed by name.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
FEInheritanceChain
|
Complete inheritance chain for the FE. |
Source code in src/glazing/references/resolver.py
validate_reference(reference: CrossReference) -> bool
¶
Validate that a reference's target exists in the dataset.
| PARAMETER | DESCRIPTION |
|---|---|
reference
|
Reference to validate.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bool
|
True if the target exists, False otherwise. |