architxt.nlp.model#

Classes

AnnotatedSentence(txt, entities, rels)

A sentence with Entity/Relation annotations.

Entity(name, start, end, id)

A named entity.

Relation(src, dst, name)

A relation between two entities.

TreeEntity(name, positions)

An entity in a tree, the name is associate with a list of leaf tree position.

TreeRel(pos_start, pos_end, name)

A relation between two entities in a tree.

class architxt.nlp.model.AnnotatedSentence(txt, entities, rels)[source]#

Bases: object

A sentence with Entity/Relation annotations.

entities#

Type:    list[Entity]

rels#

Type:    list[Relation]

txt#

Type:    str

class architxt.nlp.model.Entity(name, start, end, id)[source]#

Bases: object

A named entity.

end#

Type:    int

id#

Type:    str

name#

Type:    str

start#

Type:    int

class architxt.nlp.model.Relation(src, dst, name)[source]#

Bases: object

A relation between two entities.

dst#

Type:    str

name#

Type:    str

src#

Type:    str

class architxt.nlp.model.TreeEntity(name, positions)[source]#

Bases: object

An entity in a tree, the name is associate with a list of leaf tree position.

name#

Type:    str

positions#

Type:    list[tuple[int, …]]

property root_pos#

Get the position that covers every position of the entity.

Return type:

tuple[int, …]

class architxt.nlp.model.TreeRel(pos_start, pos_end, name)[source]#

Bases: object

A relation between two entities in a tree.

name#

Type:    str

pos_end#

Type:    tuple[int, …]

pos_start#

Type:    tuple[int, …]