segram.symbols module

Symbols are used for denoting discrete enumerable types of entities of a given class, for instance semantic roles such as subjects or direct objects of verb.

The advantage of using symbols, implemented based on enum.Flag, is that it allows combining and filtering based on symbols using binary boolean operators.

class segram.symbols.POS(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Symbol

Universal dependencies POS tags.

See definitions here.

class segram.symbols.Role(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Symbol

Syntactic role symbols.

Unlike POS tags (and standard syntactic dependencies), syntactic roles are not fixed but may be phrase-specific. Thus, the same token can play different syntactic roles in different phrases, e.g. it can be a direct object in one verb phrase and a subject in another.

Moreover, roles are used for marking tokens of which functions can not be simply determined by their POS or dependency tags, e.g. negations, even though such roles may often be fixed and not phrase-specific.

Notes

Currently, roles are used primarily for printing purposes, i.e. coloring tokens in console outputs, and therefore also selected, most important, roles are defined. Moreover, it is still an open question what roles should be defined.

VERB

Verb or a verb-like predicate.

NOUN

Noun, typically the head of a noun phrase.

SUBJ

Subject (active, passive, nominal or clausal etc.).

DOBJ

Direct object of a verb or a description.

IOBJ

Indirect object of a verb (dative).

PREP

Preposition.

POBJ

Object of a preposition.

PROOT

Root of a preposition.

DESC

Description. This includes adjectives, adverbs, and adjectival and adverbial modifiers as well as any other sort of construction used to directly describe nouns, verbs and prepositions.

BG

Background element that should be not emphasized visually when printing, e.g. printed in gray.

NEG

Negation.

QMARK

Question mark.

EXCLAM

Exclamation mark.

INTJ

Interjection.

class segram.symbols.Tense(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Symbol

Tense symbols.

PAST

Past tense

PRESENT

Present tense.

FUTURE

Future tense.

class segram.symbols.Modal(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Symbol

Modal symbols.

NULL

No modality.

ABILITY

Ability mood (e.g. ‘can’ or ‘could’ in English).

POSSIBILITY

POssibility mode (e.g. ‘may’ or ‘might’ in English).

NECESSITY

Necessity mode (e.g. ‘must’ in English).

OBLIGATION

Obligation mode (e.g. ‘shoud’ or ‘ought to’ in English).

NEED

Need moge (e.g. ‘need’ in English).

class segram.symbols.Mood(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Symbol

Grammatical mood.

Currently only few selected moods are implemented.

REAL

Standard indicative mood (realis).

IMP

Imperative mood.