segram.semantic.frames module

class segram.semantic.frames.Frame(story: Story)[source]

Bases: Sequence

Semantic frame class.

Semantic frames groups phrases from a given segram.semantic.Story instance according to some selection criteria.

story

A Story the frame belongs to.

matcher

Arbitrary callable implementing filtering function.

phrases

Phrases matching the criteria.

abstract is_match(phrase: Phrase) bool[source]

Does phrase match the criteria of the frame.

match(phrase: Phrase) bool[source]

Match phrase against the selection criteria.

classmethod subclass(is_match: Callable[[Phrase], bool]) type[Self][source]

Make subclass from a callable.

Callable is injected into a class as a staticmethod, so it should not use the self parameter.

class segram.semantic.frames.Actants(story: Story)[source]

Bases: Frame

Semantic frame of actants.

is_match(phrase: Phrase) bool[source]

Does phrase match the criteria of the frame.

class segram.semantic.frames.Events(story: Story)[source]

Bases: Frame

Semantic frame of events.

is_match(phrase: Phrase) bool[source]

Does phrase match the criteria of the frame.