8.1.10. cltk.morphology package

8.1.10.1. Submodules

8.1.10.2. cltk.morphology.akk module

Functions and classes for Akkadian morphology.

cltk.morphology.akk.get_bound_form(noun, gender)[source]

Return bound form of nound, given its gender.

>>> get_bound_form("awīlum", "m")
'awīl'
Return type

str

cltk.morphology.akk.decline_noun(noun, gender, mimation=True)[source]
Return a list of all possible Akkadiandeclined forms given any form

of a noun and its gender.

>>> decline_noun('iltum', 'f')
[('iltum', {'case': 'nominative', 'number': 'singular'}), ('iltam', {'case': 'accusative', 'number': 'singular'}), ('iltim', {'case': 'genitive', 'number': 'singular'}), ('iltān', {'case': 'nominative', 'number': 'dual'}), ('iltīn', {'case': 'oblique', 'number': 'dual'}), ('ilātum', {'case': 'nominative', 'number': 'plural'}), ('ilātim', {'case': 'oblique', 'number': 'plural'})]
Return type

List[Tuple[str, Dict[str, str]]]

8.1.10.3. cltk.morphology.lat module

This modules provides Decliner for Latin. Given a lemma, the Decliner will provide each grammatically valid forms

This work is based on the lexical and linguistic data built for and by the Collatinus Team ( https://github.com/biblissima/collatinus ). This module hence inherit the license from the original project. The objective of this module is to port part of Collatinus to CLTK.

class cltk.morphology.lat.CollatinusDecliner[source]

Bases: object

Latin Decliner based on Collatinus data and approach to declining words for Latin

# Ensure you have downloaded the corpus latin_models_cltk before running this
from cltk.stem.lat.declension import CollatinusDecliner

decliner = CollatinusDecliner()
print(decliner.decline("via"))

 [
     ('via', '--s----n-'), ('via', '--s----v-'), ('viam', '--s----a-'), ('viae', '--s----g-'),
     ('viae', '--s----d-'), ('via', '--s----b-'), ('viae', '--p----n-'), ('viae', '--p----v-'),
     ('vias', '--p----a-'), ('viarum', '--p----g-'), ('viis', '--p----d-'), ('viis', '--p----b-')
 ]
_remove_disambiguation(root)[source]

Remove disambiguation index from lemma root

Parameters

root – Root in Collatinus

Returns

Cleaned root

_getRoots(lemma, model)[source]

Retrieve the known roots of a lemma

Parameters
  • lemma (str) – Canonical form of the word (lemma)

  • model (dict) – Model data from the loaded self.__data__. Can be passed by decline()

Returns

Dictionary of roots with their root identifier as key

Return type

dict

decline(lemma, flatten=False, collatinus_dict=False)[source]

Decline a lemma

Warning

POS are incomplete as we do not detect the type outside of verbs, participle and adjective.

Raises

CLTKException – When the lemma is unknown to our data

Parameters
  • lemma (str) – Lemma (Canonical form) to decline

  • flatten (bool) – If set to True, returns a list of forms without natural language information about them

  • collatinus_dict (bool) – If sets to True, Dictionary of grammatically valid forms, including variants, with keys corresponding to morpho informations.

Returns

List of tuple where first value is the form and second the pos, ie [(“sum”, “v1ppip—“)]

Return type

list or dict

property lemmas
Return type

Dict[str, Dict[str, str]]

8.1.10.4. cltk.morphology.morphosyntax module

A module for representing universal morphosyntactic feature bundles.

class cltk.morphology.morphosyntax.MorphosyntacticFeatureBundle(*features)[source]

Bases: object

A representation of a set of features, usually associated with a word form.

all()[source]
Return type

List[Tuple[Type[MorphosyntacticFeature], List[MorphosyntacticFeature]]]

underspecify(feature_name)[source]

Underspecify the given feature in the bundle. >>> f1 = f(F.pos, N.pos, V.neg) >>> f1.underspecify(F) >>> f1[F] is Underspecified True

Return type

None

matches(other)[source]

This feature bundle matches other if other contains all the features of this bundle, i.e. if this bundle is an improper subset of other. Underspecified features will match.

>>> f1 = f(F, N.pos, V.neg)
>>> f2 = f(F.neg, N.pos, V.neg)
>>> f3 = f(F.pos, N.neg, V.pos)
>>> f1.matches(f2)
True
>>> f1.matches(f3)
False
Return type

bool

cltk.morphology.morphosyntax.f

alias of cltk.morphology.morphosyntax.MorphosyntacticFeatureBundle

cltk.morphology.morphosyntax.to_categorial(pos)[source]

Maps UD parts of speech to binary categorial feature bundles. In some cases these are underspecified, including empty bundles for interjections. >>> to_categorial(POS.adjective) {F: [neg], N: [pos], V: [pos]} >>> to_categorial(POS.particle) {F: [pos]} >>> to_categorial(POS.interjection) {}

Return type

MorphosyntacticFeatureBundle

cltk.morphology.morphosyntax.from_ud(feature_name, feature_value)[source]

For a given Universal Dependencies feature name and value, return the appropriate feature class/value. >>> from_ud(‘Case’, ‘Abl’) ablative >>> from_ud(‘Abbr’, ‘Yes’) pos >>> from_ud(‘PronType’, ‘Ind’) indefinite

Return type

Optional[MorphosyntacticFeature]

8.1.10.5. cltk.morphology.universal_dependencies_features module

Data types for each morphological category and features annotated by the Universal Dependencies (UD) project (<https://universaldependencies.org/guidelines.html>_).

These are from v2 of UD, except for Strength which is from v1 and was (as of 12/2020) still in the Gothic treebank.

class cltk.morphology.universal_dependencies_features.MorphosyntacticFeature(value)[source]

Bases: cltk.utils.utils.CLTKEnum

A generic multivalued morphosyntactic feature.

class cltk.morphology.universal_dependencies_features.N(value)[source]

Bases: cltk.morphology.universal_dependencies_features.MorphosyntacticFeature

A `nominal word <https://en.wikipedia.org/wiki/Nominal_(linguistics)>_, “a category used to group together nouns and adjectives based on shared properties. The motivation for nominal grouping is that in many languages nouns and adjectives share a number of morphological and syntactic properties.”

pos = 1
neg = 2
class cltk.morphology.universal_dependencies_features.V(value)[source]

Bases: cltk.morphology.universal_dependencies_features.MorphosyntacticFeature

A verbal word, which “typically signal events and actions, can constitute a minimal predicate in a clause, and govern the number and types of other constituents which may occur in the clause.” See notes that verb-like forms may be better classed as eg, nouns, adjectives, etc..

pos = 1
neg = 2
class cltk.morphology.universal_dependencies_features.F(value)[source]

Bases: cltk.morphology.universal_dependencies_features.MorphosyntacticFeature

A function word. These “have little lexical meaning or have ambiguous meaning and express grammatical relationships among other words within a sentence, or specify the attitude or mood of the speaker”.

pos = 1
neg = 2
class cltk.morphology.universal_dependencies_features.POS(value)[source]

Bases: cltk.morphology.universal_dependencies_features.MorphosyntacticFeature

The POS “feature” represents the list of syntactic categories published by the UD project. See https://universaldependencies.org/u/pos/index.html

adjective = 1
adposition = 2
adverb = 3
auxiliary = 4
coordinating_conjunction = 5
determiner = 6
interjection = 7
noun = 8
numeral = 9
particle = 10
possessors_number = 11
pronoun = 12
proper_noun = 13
punctuation = 14
subordinating_conjunction = 15
symbol = 16
verb = 17
other = 18
class cltk.morphology.universal_dependencies_features.VerbForm(value)[source]

Bases: cltk.morphology.universal_dependencies_features.MorphosyntacticFeature

The inlectional type of the verb. Possibly this confuses tense, aspect, and other more privitive morphosyntactic informaition. see https://universaldependencies.org/u/feat/VerbForm.html

converb = 1
finite = 2
gerund = 3
gerundive = 4
infinitive = 5
participle = 6
supine = 7
masdar = 8
class cltk.morphology.universal_dependencies_features.Mood(value)[source]

Bases: cltk.morphology.universal_dependencies_features.MorphosyntacticFeature

The mood of a verb. see https://universaldependencies.org/u/feat/Mood.html

admirative = 1
conditional = 2
desiderative = 3
imperative = 4
indicative = 5
jussive = 6
necessitative = 7
optative = 8
potential = 9
purposive = 10
quotative = 11
subjunctive = 12
class cltk.morphology.universal_dependencies_features.Tense(value)[source]

Bases: cltk.morphology.universal_dependencies_features.MorphosyntacticFeature

The tense of a verb, i.e. the time of the eventuality in relation to a reference point in time. see https://universaldependencies.org/u/feat/Tense.html

future = 1
imperfect = 2
past = 3
pluperfect = 4
present = 5
class cltk.morphology.universal_dependencies_features.Aspect(value)[source]

Bases: cltk.morphology.universal_dependencies_features.MorphosyntacticFeature

The aspect of the verb, i.e. the temporal structure of the eventuality. see https://universaldependencies.org/u/feat/Aspect.html

habitual = 1
imperfective = 2
iterative = 3
perfective = 4
progressive = 5
prospective = 6
class cltk.morphology.universal_dependencies_features.Voice(value)[source]

Bases: cltk.morphology.universal_dependencies_features.MorphosyntacticFeature

The voice of the verb, i.e. the relation of the participants to the eventuality. see https://universaldependencies.org/u/feat/Voice.html

active = 1
antipassive = 2
beneficiary_focus = 3
location_focus = 4
causative = 5
direct = 6
inverse = 7
middle = 8
passive = 9
reciprocal = 10
class cltk.morphology.universal_dependencies_features.Evidentiality(value)[source]

Bases: cltk.morphology.universal_dependencies_features.MorphosyntacticFeature

What evidence is there for the assertion of the eventuality described by the verb? Is it based on the speaker’s knowledge, or indirect? see https://universaldependencies.org/u/feat/Evident.html

first_hand = 1
non_first_hand = 2
class cltk.morphology.universal_dependencies_features.Polarity(value)[source]

Bases: cltk.morphology.universal_dependencies_features.MorphosyntacticFeature

Is the proposition negative or positive? see https://universaldependencies.org/u/feat/Polarity.html

pos = 1
neg = 2
class cltk.morphology.universal_dependencies_features.Person(value)[source]

Bases: cltk.morphology.universal_dependencies_features.MorphosyntacticFeature

The grammatical person of the verb, i.e. the participant indicated by the subject. # see https://universaldependencies.org/u/feat/Person.html

zeroth = 1
first = 2
second = 3
third = 4
fourth = 5
psor = 6
subj = 7
class cltk.morphology.universal_dependencies_features.Politeness(value)[source]

Bases: cltk.morphology.universal_dependencies_features.MorphosyntacticFeature

The morphological reflex of the formal register with which participants are addressed in the sentence, affecting verbs and pronouns. see https://universaldependencies.org/u/feat/Polite.html

elevated = 1
formal = 2
humble = 3
informal = 4
class cltk.morphology.universal_dependencies_features.Clusivity(value)[source]

Bases: cltk.morphology.universal_dependencies_features.MorphosyntacticFeature

Does a first person plural subject include the addressee? see https://universaldependencies.org/u/feat/Clusivity.html

exclusive = 1
inclusive = 2
class cltk.morphology.universal_dependencies_features.Strength(value)[source]

Bases: cltk.morphology.universal_dependencies_features.MorphosyntacticFeature

Is this a strong or weak verb or adjective? UDv1 feature, specific to Gothic. see http://universaldependencies.org/docsv1/got/feat/Strength.html

strong = 1
weak = 2
class cltk.morphology.universal_dependencies_features.Case(value)[source]

Bases: cltk.morphology.universal_dependencies_features.MorphosyntacticFeature

The case of a noun phrase. see https://universaldependencies.org/u/feat/Case.html

nominative = 1
accusative = 2
ergative = 3
absolutive = 4
abessive = 5
befefactive = 6
causative = 7
comparative = 8
considerative = 9
comitative = 10
dative = 11
distributive = 12
equative = 13
genitive = 14
instrumental = 15
partitive = 16
vocative = 17
ablative = 18
additive = 19
adessive = 20
allative = 21
delative = 22
elative = 23
essive = 24
illative = 25
inessive = 26
lative = 27
locative = 28
perlative = 29
sublative = 30
superessive = 31
terminative = 32
temporal = 33
translative = 34
class cltk.morphology.universal_dependencies_features.Gender(value)[source]

Bases: cltk.morphology.universal_dependencies_features.MorphosyntacticFeature

The grammatical gender of a nominal. see https://universaldependencies.org/u/feat/Gender.html

masculine = 1
feminine = 2
neuter = 3
common = 4
class cltk.morphology.universal_dependencies_features.Animacy(value)[source]

Bases: cltk.morphology.universal_dependencies_features.MorphosyntacticFeature

The soul-type of an entity (as it were.) see https://universaldependencies.org/u/feat/Animacy.html

animate = 1
human = 2
inanimate = 3
non_human = 4
class cltk.morphology.universal_dependencies_features.Number(value)[source]

Bases: cltk.morphology.universal_dependencies_features.MorphosyntacticFeature

The count type of an entity. see https://universaldependencies.org/u/feat/Number.html

collective = 1
count_plural = 2
dual = 3
greater_paucal = 4
greater_plural = 5
inverse_number = 6
paucal = 7
plural = 8
plurale_tantum = 9
singular = 10
trial = 11
psor = 12
class cltk.morphology.universal_dependencies_features.NumForm(value)[source]

Bases: cltk.morphology.universal_dependencies_features.MorphosyntacticFeature

Feature of cardinal and ordinal numbers. Is the number expressed by digits or as a word? See https://universaldependencies.org/cs/feat/NumForm.html.

word = 1
digit = 2
roman = 3
reference = 4
class cltk.morphology.universal_dependencies_features.Definiteness(value)[source]

Bases: cltk.morphology.universal_dependencies_features.MorphosyntacticFeature

The relationship between noun phrases and entities in or not in the discoursive context. see https://universaldependencies.org/u/feat/Definiteness.html

complex = 1
construct_state = 2
definite = 3
indefinite = 4
specific_indefinite = 5
class cltk.morphology.universal_dependencies_features.Degree(value)[source]

Bases: cltk.morphology.universal_dependencies_features.MorphosyntacticFeature

The degree of adjectives. see https://universaldependencies.org/u/feat/Degree.html

absolute_superlative = 1
comparative = 2
equative = 3
positive = 4
superlative = 5
class cltk.morphology.universal_dependencies_features.NameType(value)[source]

Bases: cltk.morphology.universal_dependencies_features.MorphosyntacticFeature

The type of a named entity, mostly applying to proper nouns. see https://universaldependencies.org/u/feat/NameType.html

place = 1
person = 2
person_given_name = 3
person_surname = 4
nationality = 5
company = 6
product = 7
other = 8
class cltk.morphology.universal_dependencies_features.PrononimalType(value)[source]

Bases: cltk.morphology.universal_dependencies_features.MorphosyntacticFeature

A subclassification of pronouns. see https://universaldependencies.org/u/feat/PronType.html

article = 1
demonstrative = 2
emphatic = 3
exclamative = 4
indefinite = 5
interrogative = 6
negative = 7
personal = 8
reciprocal = 9
relative = 10
total = 11
class cltk.morphology.universal_dependencies_features.AdpositionalType(value)[source]

Bases: cltk.morphology.universal_dependencies_features.MorphosyntacticFeature

Defines the position of an adposition. see https://universaldependencies.org/u/feat/AdpType.html

preposition = 1
postposition = 2
circumposition = 3
vocalized_adposition = 4
class cltk.morphology.universal_dependencies_features.AdverbialType(value)[source]

Bases: cltk.morphology.universal_dependencies_features.MorphosyntacticFeature

What type of adverb is this? see https://universaldependencies.org/u/feat/AdvType.html

manner = 1
location = 2
time = 3
degree = 4
cause = 5
modality = 6
class cltk.morphology.universal_dependencies_features.VerbType(value)[source]

Bases: cltk.morphology.universal_dependencies_features.MorphosyntacticFeature

If this is a functional verb, what kind is it? see https://universaldependencies.org/u/feat/VerbType.html

auxiliary = 1
copula = 2
modal = 3
light = 4
class cltk.morphology.universal_dependencies_features.Possessive(value)[source]

Bases: cltk.morphology.universal_dependencies_features.MorphosyntacticFeature

Is this nominal form marked as a possessive? see https://universaldependencies.org/u/feat/Poss.html

pos = 1
neg = 2
class cltk.morphology.universal_dependencies_features.Numeral(value)[source]

Bases: cltk.morphology.universal_dependencies_features.MorphosyntacticFeature

A subclassification of numeric types. see https://universaldependencies.org/u/feat/NumType.html

cardinal = 1
distributive = 2
fractional = 3
multiplicative = 4
ordinal = 5
range = 6
sets = 7
class cltk.morphology.universal_dependencies_features.Reflexive(value)[source]

Bases: cltk.morphology.universal_dependencies_features.MorphosyntacticFeature

Is the pronoun reflexive? see https://universaldependencies.org/u/feat/Reflex.html

pos = 1
neg = 2
class cltk.morphology.universal_dependencies_features.Foreign(value)[source]

Bases: cltk.morphology.universal_dependencies_features.MorphosyntacticFeature

Is this a foreign word, relative to the language of the sentences? see https://universaldependencies.org/u/feat/Foreign.html

pos = 1
neg = 2
class cltk.morphology.universal_dependencies_features.Abbreviation(value)[source]

Bases: cltk.morphology.universal_dependencies_features.MorphosyntacticFeature

Is this word an abbreviation? see https://universaldependencies.org/u/feat/Abbr.html

pos = 1
neg = 2
class cltk.morphology.universal_dependencies_features.Typo(value)[source]

Bases: cltk.morphology.universal_dependencies_features.MorphosyntacticFeature

Does this word contain a typo? see https://universaldependencies.org/u/feat/Typo.html

pos = 1
neg = 2

8.1.10.6. cltk.morphology.utils module

Misc helper functions for extracting morphological info from CLTK data structures.

cltk.morphology.utils.get_pos(word)[source]

Take word, return structured info.

Return type

Optional[str]

cltk.morphology.utils.get_features(word, prepend_to_label=None)[source]

Take a word, return a list of feature labels.

Return type

Tuple[List[str], List[Union[str, int, float, None]]]