glazing.propbank.models¶
PropBank core data models.
models
¶
PropBank data models.
Defines Pydantic models for PropBank framesets, rolesets, and annotations.
| CLASS | DESCRIPTION |
|---|---|
Frameset |
Container for all senses of a predicate. |
Alias |
Alias for a predicate with part of speech. |
ArgAlias |
Argument-specific alias. |
Aliases |
Container for all alias types. |
Usage |
Usage information for a resource. |
UsageNotes |
Container for usage information. |
Roleset |
A single sense of a predicate with its semantic roles. |
Role |
Semantic role definition. |
RoleLink |
Link from a role to VerbNet/FrameNet. |
LexLink |
Confidence-scored link to external resource. |
PropBankAnnotation |
PropBank annotation structure for examples. |
Arg |
Argument annotation in an example. |
Rel |
Relation/predicate marker in example. |
AMRAnnotation |
AMR annotation for an example. |
Example |
Annotated example sentence. |
Classes¶
AMRAnnotation
pydantic-model
¶
Bases: GlazingBaseModel
AMR annotation for an example.
| ATTRIBUTE | DESCRIPTION |
|---|---|
version |
AMR version.
TYPE:
|
graph |
AMR graph representation.
TYPE:
|
Examples:
>>> amr = AMRAnnotation(
... version="1.0",
... graph="(g / give-01 :ARG0 (p / person :name John) :ARG1 (g2 / gift))"
... )
Fields:
-
version(str) -
graph(str)
Alias
pydantic-model
¶
Bases: GlazingBaseModel
Alias for a predicate with part of speech.
| ATTRIBUTE | DESCRIPTION |
|---|---|
text |
The alias text (e.g., "abandon", "abandonment").
TYPE:
|
pos |
Part of speech marker.
TYPE:
|
Examples:
Fields:
-
text(str) -
pos(AliasPOS)
Validators:
-
validate_alias_text→text
Functions¶
validate_alias_text(v: str) -> str
pydantic-validator
¶
Validate alias text format.
| PARAMETER | DESCRIPTION |
|---|---|
v
|
Alias text to validate.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
Validated alias text. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If alias text format is invalid. |
Source code in src/glazing/propbank/models.py
Aliases
pydantic-model
¶
Bases: GlazingBaseModel
Container for all alias types.
| ATTRIBUTE | DESCRIPTION |
|---|---|
alias |
Regular aliases for the predicate.
TYPE:
|
argalias |
Argument-specific aliases.
TYPE:
|
Examples:
>>> aliases = Aliases(
... alias=[Alias(text="give", pos="v")],
... argalias=[ArgAlias(text="giver", pos="n", arg="0")]
... )
Fields:
Arg
pydantic-model
¶
Bases: GlazingBaseModel
Argument annotation in an example.
| ATTRIBUTE | DESCRIPTION |
|---|---|
type |
Argument type (e.g., "ARG0", "ARGM-TMP").
TYPE:
|
start |
Start token index or "?" for unknown.
TYPE:
|
end |
End token index or "?" for unknown.
TYPE:
|
text |
Extracted text (optional).
TYPE:
|
Examples:
>>> arg = Arg(type="ARG0", start=0, end=1, text="John")
>>> arg = Arg(type="ARGM-TMP", start=5, end=6, text="yesterday")
>>> arg = Arg(type="ARG0", start="?", end="?") # Unknown position
Fields:
-
type(ArgumentTypePB) -
start(IntOrQuestionMark) -
end(IntOrQuestionMark) -
text(str | None)
Validators:
-
validate_indices→start,end
Functions¶
validate_indices(v: int | str) -> int | str
pydantic-validator
¶
Validate token indices.
| PARAMETER | DESCRIPTION |
|---|---|
v
|
Token index or "?" to validate.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
int | str
|
Validated token index or "?". |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If token index is invalid. |
Source code in src/glazing/propbank/models.py
ArgAlias
pydantic-model
¶
Bases: GlazingBaseModel
Argument-specific alias.
| ATTRIBUTE | DESCRIPTION |
|---|---|
text |
The alias text (e.g., "actress" for arg0 of "act").
TYPE:
|
pos |
Part of speech marker.
TYPE:
|
arg |
Argument number it refers to (e.g., "0", "1").
TYPE:
|
Examples:
>>> arg_alias = ArgAlias(text="giver", pos="n", arg="0")
>>> arg_alias = ArgAlias(text="gift", pos="n", arg="1")
Fields:
-
text(str) -
pos(AliasPOS) -
arg(str)
Validators:
-
validate_arg→arg
Functions¶
validate_arg(v: str) -> str
pydantic-validator
¶
Validate argument reference.
| PARAMETER | DESCRIPTION |
|---|---|
v
|
Argument reference to validate.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
Validated argument reference. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If argument reference is invalid. |
Source code in src/glazing/propbank/models.py
Example
pydantic-model
¶
Bases: GlazingBaseModel
Annotated example sentence.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
Optional example name.
TYPE:
|
src |
Source of the example.
TYPE:
|
text |
The sentence text.
TYPE:
|
propbank |
PropBank annotation.
TYPE:
|
amr |
AMR annotation.
TYPE:
|
notes |
Additional notes.
TYPE:
|
Examples:
>>> example = Example(
... text="John gave Mary a book",
... propbank=PropBankAnnotation(
... args=[
... Arg(type="ARG0", start=0, end=1),
... Arg(type="ARG2", start=2, end=3),
... Arg(type="ARG1", start=4, end=6)
... ],
... rel=Rel(relloc="1")
... )
... )
Fields:
-
name(str | None) -
src(str | None) -
text(str) -
propbank(PropBankAnnotation | None) -
amr(AMRAnnotation | None) -
notes(list[str])
Frameset
pydantic-model
¶
Bases: GlazingBaseModel
Container for all senses of a predicate.
| ATTRIBUTE | DESCRIPTION |
|---|---|
predicate_lemma |
The predicate lemma (e.g., "give", "abandon").
TYPE:
|
rolesets |
All senses of this predicate.
TYPE:
|
notes |
Additional notes about the frameset.
TYPE:
|
Examples:
>>> frameset = Frameset(
... predicate_lemma="give",
... rolesets=[
... Roleset(id="give.01", name="transfer", roles=[...]),
... Roleset(id="give.02", name="emit", roles=[...])
... ]
... )
Fields:
-
predicate_lemma(PredicateLemma) -
rolesets(list[Roleset]) -
notes(list[str])
Validators:
-
validate_predicate_lemma→predicate_lemma
Functions¶
validate_predicate_lemma(v: str) -> str
pydantic-validator
¶
Validate predicate lemma format.
| PARAMETER | DESCRIPTION |
|---|---|
v
|
Predicate lemma to validate.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
Validated predicate lemma. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If predicate lemma format is invalid. |
Source code in src/glazing/propbank/models.py
LexLink
pydantic-model
¶
Bases: GlazingBaseModel
Confidence-scored link to external resource.
| ATTRIBUTE | DESCRIPTION |
|---|---|
class_name |
Name of the external class/frame.
TYPE:
|
confidence |
Confidence score (0.0-1.0).
TYPE:
|
resource |
Target resource type.
TYPE:
|
version |
Version of the target resource.
TYPE:
|
src |
Source of the mapping.
TYPE:
|
Examples:
>>> link = LexLink(
... class_name="give-13.1",
... confidence=0.95,
... resource="VerbNet",
... version="3.4",
... src="manual"
... )
Fields:
-
class_name(str) -
confidence(float) -
resource(ResourceType) -
version(str) -
src(MappingSource)
Validators:
-
validate_confidence→confidence
Functions¶
validate_confidence(v: float) -> float
pydantic-validator
¶
Validate confidence score.
| PARAMETER | DESCRIPTION |
|---|---|
v
|
Confidence score to validate.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
float
|
Validated confidence score. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If confidence is not between 0 and 1. |
Source code in src/glazing/propbank/models.py
PropBankAnnotation
pydantic-model
¶
Bases: GlazingBaseModel
PropBank annotation structure for examples.
| ATTRIBUTE | DESCRIPTION |
|---|---|
args |
Argument annotations.
TYPE:
|
rel |
Predicate/relation marker (optional, some annotations lack rel).
TYPE:
|
notes |
Additional annotation notes.
TYPE:
|
Examples:
>>> annotation = PropBankAnnotation(
... args=[
... Arg(type="ARG0", start=0, end=1, text="John"),
... Arg(type="ARG1", start=3, end=4, text="gift")
... ],
... rel=Rel(relloc="2", text="gave")
... )
Fields:
Rel
pydantic-model
¶
Bases: GlazingBaseModel
Relation/predicate marker in example.
| ATTRIBUTE | DESCRIPTION |
|---|---|
relloc |
Location indices (can be space-separated).
TYPE:
|
text |
The predicate text.
TYPE:
|
Examples:
Fields:
-
relloc(str) -
text(str | None)
Validators:
-
validate_relloc→relloc
Functions¶
validate_relloc(v: str) -> str
pydantic-validator
¶
Validate relation location format.
| PARAMETER | DESCRIPTION |
|---|---|
v
|
Relation location to validate.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
Validated relation location. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If location format is invalid. |
Source code in src/glazing/propbank/models.py
Role
pydantic-model
¶
Bases: GlazingBaseModel
Semantic role definition.
| ATTRIBUTE | DESCRIPTION |
|---|---|
n |
Argument number (0-7, m, or M).
TYPE:
|
f |
Function tag.
TYPE:
|
descr |
Description of the role.
TYPE:
|
rolelinks |
Links to external resources.
TYPE:
|
Examples:
Fields:
-
n(ArgumentNumber) -
f(FunctionTag) -
descr(str) -
rolelinks(list[RoleLink])
RoleLink
pydantic-model
¶
Bases: GlazingBaseModel
Link from a role to VerbNet/FrameNet.
| ATTRIBUTE | DESCRIPTION |
|---|---|
class_name |
VerbNet class or FrameNet frame.
TYPE:
|
resource |
Target resource type.
TYPE:
|
version |
Version of the target resource.
TYPE:
|
role |
Role name in target resource.
TYPE:
|
Examples:
>>> link = RoleLink(
... class_name="give-13.1",
... resource="VerbNet",
... version="3.4",
... role="Agent"
... )
Fields:
-
class_name(str) -
resource(ResourceType) -
version(str) -
role(str | None)
Validators:
-
validate_class_name→class_name
Functions¶
validate_class_name(v: str) -> str
pydantic-validator
¶
Validate VerbNet class or FrameNet frame name.
| PARAMETER | DESCRIPTION |
|---|---|
v
|
Class name to validate.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
Validated class name. |
Source code in src/glazing/propbank/models.py
Roleset
pydantic-model
¶
Bases: GlazingBaseModel
A single sense of a predicate with its semantic roles.
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
Roleset identifier (e.g., "give.01").
TYPE:
|
name |
Optional descriptive name.
TYPE:
|
aliases |
Predicate aliases.
TYPE:
|
roles |
Semantic roles for this sense.
TYPE:
|
usagenotes |
Usage information.
TYPE:
|
lexlinks |
Confidence-scored external links.
TYPE:
|
examples |
Annotated example sentences.
TYPE:
|
notes |
Additional notes.
TYPE:
|
Examples:
>>> roleset = Roleset(
... id="give.01",
... name="transfer",
... roles=[
... Role(n="0", f="PAG", descr="giver"),
... Role(n="1", f="PPT", descr="thing given"),
... Role(n="2", f="GOL", descr="entity given to")
... ]
... )
Fields:
-
id(RolesetID) -
name(str | None) -
aliases(Aliases | None) -
roles(list[Role]) -
usagenotes(UsageNotes | None) -
lexlinks(list[LexLink]) -
examples(list[Example]) -
notes(list[str])
Validators:
-
validate_roleset_id→id
Functions¶
validate_roleset_id(v: str) -> str
pydantic-validator
¶
Validate roleset ID format.
| PARAMETER | DESCRIPTION |
|---|---|
v
|
Roleset ID to validate.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
Validated roleset ID. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If roleset ID format is invalid. |
Source code in src/glazing/propbank/models.py
Usage
pydantic-model
¶
Bases: GlazingBaseModel
Usage information for a resource.
| ATTRIBUTE | DESCRIPTION |
|---|---|
resource |
The resource type (e.g., "VerbNet", "FrameNet").
TYPE:
|
version |
Version of the resource.
TYPE:
|
inuse |
Usage status indicator (+ or -).
TYPE:
|
Examples:
Fields:
-
resource(ResourceType) -
version(str) -
inuse(UsageInUse)
UsageNotes
pydantic-model
¶
Bases: GlazingBaseModel
Container for usage information.
| ATTRIBUTE | DESCRIPTION |
|---|---|
usage |
List of usage information.
TYPE:
|
Examples:
Fields:
-
usage(list[Usage])