8.1.12.1.8. cltk.phonology.non package

Old Norse phonology

8.1.12.1.8.1. Subpackages

8.1.12.1.8.2. Submodules

8.1.12.1.8.3. cltk.phonology.non.orthophonology module

Old Norse orthophonology module similar to the cltk.phonology.non.transcription with a different way to transcribe

class cltk.phonology.non.orthophonology.OldNorsePhonologicalTranscriber[source]

Bases: object

Old Norse phonological transcriber using orthophonology.

transcribe(word)[source]

8.1.12.1.8.4. cltk.phonology.non.phonology module

class cltk.phonology.non.phonology.OldNorseTranscription[source]

Bases: object

Phonological transcriber for Old Norse

transcribe(word)[source]
>>> non_transcriber = OldNorseTranscription()
>>> non_transcriber.transcribe("Óðinn")
'[oːðinː]'
Parameters:

word (str) – word to transcribe

Return type:

str

Returns:

transcribed word

class cltk.phonology.non.phonology.OldNorseSyllabifier[source]

Bases: object

Syllabifier for Old Norse

syllabify(word)[source]
>>> non_syllabifier = OldNorseSyllabifier()
>>> non_syllabifier.syllabify('Miðgarðr'.lower())
['mið', 'garðr']
Parameters:

word (str) – word to syllabify

Return type:

List[str]

Returns:

syllabified word

8.1.12.1.8.5. cltk.phonology.non.syllabifier module

Sonority hierarchy for Old Norse

8.1.12.1.8.6. cltk.phonology.non.transcription module

Old Norse transcription module. Sources: - https://fr.wikipedia.org/wiki/%C3%89criture_du_vieux_norrois - Altnordisches Elementarbuch by Friedrich Ranke and Dietrich Hofmann

class cltk.phonology.non.transcription.OldNorsePhonology(height, backness, rounded, length, ipar)[source]

Bases: cltk.phonology.non.utils.Vowel

Class that applies position-dependent phonological transformation

U_UMLAUT = {'a': 'ö', 'ö': 'u'}
static phonetic_i_umlaut(sound)[source]
>>> umlaut_a = OldNorsePhonology.phonetic_i_umlaut(a)
>>> umlaut_a.ipar
'ɛ'
>>> umlaut_au = OldNorsePhonology.phonetic_i_umlaut(DIPHTHONGS_IPA_class["au"])
>>> umlaut_au.ipar
'ɐy'
Parameters:

sound (Vowel) – vowel

Return type:

Vowel

Returns:

transformed vowel

static orthographic_i_umlaut(sound)[source]
>>> OldNorsePhonology.orthographic_i_umlaut("a")
'e'
>>> OldNorsePhonology.orthographic_i_umlaut("ý")
'ý'
Parameters:

sound (str) – vowel

Return type:

str

Returns:

transformed vowel

static phonetic_u_umlaut(sound)[source]
>>> umlaut_a = OldNorsePhonology.phonetic_u_umlaut(a)
>>> umlaut_a.ipar
'ø'
>>> umlaut_o = OldNorsePhonology.phonetic_u_umlaut(o)
>>> umlaut_o.ipar
'u'
>>> umlaut_e = OldNorsePhonology.phonetic_u_umlaut(e)
>>> umlaut_e.ipar
'e'
Parameters:

sound (Vowel) – vowel

Return type:

Vowel

Returns:

transformed vowel

static orthographic_u_umlaut(sound)[source]
>>> OldNorsePhonology.orthographic_u_umlaut("a")
'ö'
>>> OldNorsePhonology.orthographic_u_umlaut("e")
'e'
Parameters:

sound (str) – a vowel

Return type:

str

Returns:

transformed vowel

cltk.phonology.non.transcription.measure_old_norse_syllable(syllable)[source]

Old Norse syllables are considered as: - short if - long if - overlong if

>>> measure_old_norse_syllable([m, a.lengthen(), l]).name
'long'
>>> measure_old_norse_syllable([a, l]).name
'short'
>>> measure_old_norse_syllable([s, t, ee, r, k, r]).name
'long'
>>> measure_old_norse_syllable([m, o.lengthen()]).name
'long'
Parameters:

syllable (list) – list of Vowel and Consonant instances

Return type:

Optional[Length]

Returns:

instance of Length (short, long or overlong)

cltk.phonology.non.transcription.normalize_for_syllabifier(text)[source]
>>> normalize_for_syllabifier("almaːtːiɣr")
'almatiɣr'
Parameters:

text (str) – text to normalize for syllabification

Return type:

str

Returns:

normalized text for syllabification

8.1.12.1.8.7. cltk.phonology.non.utils module

To define sounds, phonetic rules for phonetic transcription.

class cltk.phonology.non.utils.AutoName(value)[source]

Bases: enum.Enum

An enumeration.

class cltk.phonology.non.utils.Manner(value)[source]

Bases: cltk.phonology.non.utils.AutoName

An enumeration.

nasal = 'nasal'
stop = 'stop'
lateral = 'lateral'
fricative = 'fricative'
trill = 'trill'
spirant = 'spirant'
affricate = 'affricate'
approximant = 'approximant'
class cltk.phonology.non.utils.Place(value)[source]

Bases: cltk.phonology.non.utils.AutoName

An enumeration.

bilabial = 'bilabial'
labio_dental = 'labio_dental'
dental = 'dental'
alveolar = 'alveolar'
post_alveolar = 'post_alveolar'
retroflex = 'retroflex'
palatal = 'palatal'
velar = 'velar'
uvular = 'uvular'
glottal = 'glottal'
class cltk.phonology.non.utils.AbstractConsonant(place=None, manner=None, voiced=None, ipar=None, geminate=None)[source]

Bases: object

Used with AbstractPosition to define an environment of a sound

class cltk.phonology.non.utils.Consonant(place, manner, voiced, ipar, geminate)[source]

Bases: cltk.phonology.non.utils.AbstractConsonant

A consonant is defined mostly by the its place (where in the vocal tract the obstruction of the consonant occurs, and which speech organs are involved), its manner how air escapes from the vocal tract when the consonant or approximant (vowel-like) sound is made), by if it is voiced or not, its length (if it is geminate). An IPA standard is at: <https://en.wikipedia.org/wiki/International_Phonetic_Alphabet>_.

match(abstract_consonant)[source]

A real consonant matches an abstract consonant if and only if the required features of the abstract consonant are also features of the real consonant. :type abstract_consonant: AbstractConsonant :param abstract_consonant: AbstractConsonant :rtype: bool :return: bool

match_list(abstract_consonant_list)[source]
lengthen()[source]
Returns:

a new lengthened Consonant

to_abstract()[source]
is_equal(other_consonnant)[source]
>>> v_consonant = Consonant(Place.labio_dental, Manner.fricative, True, "v", False)
>>> f_consonant = Consonant(Place.labio_dental, Manner.fricative, False, "f", False)
>>> v_consonant.is_equal(f_consonant)
False
Parameters:

other_consonnant

Returns:

class cltk.phonology.non.utils.Height(value)[source]

Bases: cltk.phonology.non.utils.AutoName

An enumeration.

open = 'open'
near_open = 'near_open'
open_mid = 'open_mid'
mid = 'mid'
close_mid = 'close_mid'
near_close = 'near_close'
close = 'close'
class cltk.phonology.non.utils.Backness(value)[source]

Bases: cltk.phonology.non.utils.AutoName

An enumeration.

front = 'front'
central = 'central'
back = 'back'
class cltk.phonology.non.utils.Length(value)[source]

Bases: cltk.phonology.non.utils.AutoName

An enumeration.

short = 'short'
long = 'long'
overlong = 'overlong'
class cltk.phonology.non.utils.AbstractVowel(height=None, backness=None, rounded=None, length=None, ipar=None)[source]

Bases: object

Used with AbstractPosition to define an environment of a sound

class cltk.phonology.non.utils.Vowel(height, backness, rounded, length, ipar)[source]

Bases: cltk.phonology.non.utils.AbstractVowel

https://en.wikipedia.org/wiki/Vowel

lengthen()[source]
Returns:

a new lengthened Vowel

match(abstract_vowel)[source]
match_list(abstract_vowel_list)[source]
to_abstract()[source]
i_umlaut()[source]
u_umlaut()[source]
is_equal(other_sound)[source]
Parameters:

other_sound

Returns:

class cltk.phonology.non.utils.Rank(value)[source]

Bases: cltk.phonology.non.utils.AutoName

An enumeration.

first = 'first'
inner = 'inner'
last = 'last'
class cltk.phonology.non.utils.AbstractPosition(position, before, after)[source]

Bases: object

This is a position (at the beginning, inside or at the end) that a rule can be applied at,

a sound or a set of sounds before and a sound or a set of sounds after

same_place(other)[source]
class cltk.phonology.non.utils.Position(position, before, after)[source]

Bases: object

This is a position (at the beginning, inside or at the end) of a an observed word, a sound before and a sound after

real_sound_match_abstract_sound(abstract_pos)[source]

If an observed position :type abstract_pos: AbstractPosition :param abstract_pos: :rtype: bool :return:

class cltk.phonology.non.utils.Rule(position, temp_sound, estimated_sound)[source]

Bases: object

A Rule is used to transform one sound to another according to its direct environment (the letter before and the letter after). If a rule is applicable, then it is applied.

can_apply(current_position)[source]

A Rule is applied if and only if a letter has a direct environment (the sound just before and the sound just after) which matches the environment of Rule :type current_position: Position :param current_position: :rtype: bool :return: bool

ipa_to_regular_expression(phonology)[source]
Parameters:

phonology – list of Vowel or Consonant instances

Returns:

pattern which can be the first argument of re.sub

static from_regular_expression(re_rule, estimated_sound, ipa_class)[source]
Parameters:
  • re_rule – pattern (first argument of re.sub)

  • estimated_sound – an IPA character (second argument of re.sub)

  • ipa_class – dict whose keys are IPA characters and values are Vowel or Consonant instances

Returns:

corresponding Rule instance

class cltk.phonology.non.utils.Transcriber(diphthongs_ipa, diphthongs_ipa_class, ipa_class, rules)[source]

Bases: object

There are two steps to transcribe words:
  • firstly, a greedy approximation of the pronunciation of word

  • then, use of rules to precise pronunciation of a preprocessed list of transcribed words

word_to_phonetic_representation(word, with_squared_brackets=True)[source]
Parameters:
  • word – normalized word

  • with_squared_brackets

Returns:

text_to_phonetic_representation(sentence, with_squared_brackets=True)[source]
Parameters:
  • sentence (str) –

  • with_squared_brackets

Return type:

str

Returns:

text_to_phonemes(word)[source]

Give a greedy approximation of the pronunciation of word :type word: str :param word: :rtype: list :return:

phonemes_to_phonetic_representation(phonemes)[source]

Use of rules to precise pronunciation of a preprocessed list of transcribed words :type phonemes: list :param phonemes: list(Vowel or Consonant) :rtype: str :return: str

class cltk.phonology.non.utils.BasePhonologicalRule(condition, action)[source]

Bases: object

perform_action(phonemes, pos)[source]
class cltk.phonology.non.utils.PhonologicalRule(condition, action)[source]

Bases: cltk.phonology.non.utils.BasePhonologicalRule

check_environment(phonemes, pos)[source]
class cltk.phonology.non.utils.WordInitialPhonologicalRule(condition, action)[source]

Bases: cltk.phonology.non.utils.BasePhonologicalRule

check_environment(phonemes, pos)[source]
perform_action(phonemes, _)[source]
class cltk.phonology.non.utils.WordFinalPhonologicalRule(condition, action)[source]

Bases: cltk.phonology.non.utils.BasePhonologicalRule

check_environment(phonemes, pos)[source]
perform_action(phonemes, _)[source]
class cltk.phonology.non.utils.IPATranscriber(digraphs, dipthongs, alphabet, rules)[source]

Bases: object

static tokenize(text)[source]
transcribe_word(word)[source]
transcribe(text)[source]