8.1.13. cltk.prosody package

8.1.13.1. Subpackages

8.1.13.2. Submodules

8.1.13.3. cltk.prosody.gmh module

Module for calculating rhyme scheme for a MHG stanza.

class cltk.prosody.gmh.Verse(text)[source]

Bases: object

Calculate rhyme scheme for a MHG stanza.

to_phonetics()[source]

Transcribe phonetics.

rhyme_scheme(rhyme_size=3)[source]

Calculates the rhyme scheme of a given stanza. It doesn’t yet support phonetical rhyming (homophones) and thus is still error-prone

Example

>>> stanza = ['Ein rîchiu küneginne, frou Uote ir muoter hiez.', 'ir vater der hiez Dancrât, der in diu erbe liez', 'sît nâch sîme lebene, ein ellens rîcher man,', 'der ouch in sîner jugende grôzer êren vil gewan.']
>>> S = Verse(stanza)
>>> S.rhyme_scheme(2)
'AABB'

8.1.13.4. cltk.prosody.grc module

This program returns the prosimetric scansion of Greek texts.

A user is first prompted to supply the file path of the text they wish to scan. Note that this text must be a relatively ‘clean’ text, as the opening function (i.e., tokenize) will only remove numbers and all punctuation that is not a period. The tokenizer will also force lower case on the text. The text will then be tokenized and syllabified. Before the text undergoes the actual scansion functions, the text will be re-tokenized into a simple list of words and syllables. Finally, the simplified tokenized text will be scanned according to typical Greek scansion rules. The details of these rules are delineated in the docstrings of the specific scansion functions. The final output is the resulting scansion.

Warning

Known bug: Reduplicated syllables in a single sentence are not scanned separately.

class cltk.prosody.grc.Scansion[source]

Bases: object

Scans Greek texts that already contain macronized (i.e., long and shorts) texts.

scan_text(input_string)[source]

The primary method for the class.

Parameters:

input_string (str) – A string of macronized text.

Return type:

List[str]

Returns:

List representation of each word’s long (¯) and short (˘) values.

>>> from cltk.prosody.grc import Scansion
>>> text_string = "νέος μὲν καὶ ἄπειρος, δικῶν ἔγωγε ἔτι. μὲν καὶ ἄπειρος."
>>> Scansion().scan_text(text_string)
['˘¯¯¯˘¯¯˘¯˘¯˘˘x', '¯¯˘¯x']
_clean_text(text)[source]

Remove input text of extraneous (non-stop) punction (e.g., ","). By default, ":", ";", and "." are defined as stops.

Parameters:

text (str) – Text string containing non-stop punctuation.

Return type:

str

Returns:

Text with unnecessary punctuation removed

>>> from cltk.prosody.grc import Scansion
>>> not_clean = "νέος μὲν καὶ ἄπειρος, δικῶν ἔγωγε ἔτι. μὲν καὶ ἄπειρος."
>>> Scansion()._clean_text(not_clean)
'νέος μὲν καὶ ἄπειρος δικῶν ἔγωγε ἔτι. μὲν καὶ ἄπειρος.'
_clean_accents(text)[source]

Remove most accent marks. This the circumflexes over alphas and iotas in the text since they mark vocalic quantity.

Parameters:

text (str) – Text string with accents.

Return type:

str

Returns:

Text string with only accents required for processing.

>>> from cltk.prosody.grc import Scansion
>>> unclean_accents = "νέος μὲν καὶ ἄπειρος, δικῶν ἔγωγε ἔτι. μὲν καὶ ἄπειρος."
>>> Scansion()._clean_accents(unclean_accents)
'νεος μεν και απειρος δικων εγωγε ετι. μεν και απειρος.'
_tokenize(text)[source]

Tokenize the text into a list of sentences with a list of words.

Parameters:

text (str) – Text string

Return type:

List[List[str]]

Returns:

List of words within a list of sentences

>>> from cltk.prosody.grc import Scansion
>>> not_tokenized = "νέος μὲν καὶ ἄπειρος, δικῶν ἔγωγε ἔτι. μὲν καὶ ἄπειρος."
>>> Scansion()._tokenize(not_tokenized)
[['νεος', 'μεν', 'και', 'απειρος', 'δικων', 'εγωγε', 'ετι.'], ['μεν', 'και', 'απειρος.']]
static _syllable_condenser(words_syllables)[source]

Reduce a list of [sentence[word[syllable]]] to [sentence[syllable]].

Parameters:

words_syllables (List[List[List[str]]]) – List of syllables

Return type:

List[List[str]]

Returns:

List of words

>>> from cltk.prosody.grc import Scansion
>>> input_syllables = [[["νε", "ος"], ["μεν"], ["και"], ["α", "πει", "ρος"], ["δι", "κων"], ["ε", "γω", "γε"], ["ε", "τι"]], [["μεν"], ["και"], ["α", "πει", "ρος"]]]
>>> Scansion()._syllable_condenser(input_syllables)
[['νε', 'ος', 'μεν', 'και', 'α', 'πει', 'ρος', 'δι', 'κων', 'ε', 'γω', 'γε', 'ε', 'τι'], ['μεν', 'και', 'α', 'πει', 'ρος']]
_long_by_nature(syllable)[source]

Check if syllable is long by nature. Long by nature includes:

  1. Syllable contains a diphthong

  2. Syllable contains a long vowel

Parameters:

syllable (str) – A syllable

Return type:

bool

Returns:

Whether or not input is long by nature.

>>> from cltk.prosody.grc import Scansion
>>> syllables = ["νε", "ος", "μεν", "και", "α", "πει", "ρος", "δι", "κων", "ε", "γω", "γε", "ε", "τι", "μεν", "και", "α", "πει", "ρος"]
>>> [Scansion()._long_by_nature(syllable) for syllable in syllables]
[False, False, False, True, False, True, False, False, True, False, True, False, False, False, False, True, False, True, False]
_long_by_position(syllable, sentence)[source]

Check if syllable is long by position. Returns True if syllable is long by position Long by position includes contexts when:

  1. Next syllable begins with two consonants, unless those consonants are a stop + liquid combination

  2. Next syllable begins with a double consonant

  3. Syllable ends with a consonant and the next syllable begins with a consonant

Parameters:
  • syllable (str) – Current syllable

  • sentence (List[str]) – Sentence in which syllable appears

Return type:

bool

Returns:

Whether or not a syllable is long by position

>>> from cltk.prosody.grc import Scansion
>>> syllables_sentence = ["μεν", "και", "α", "πει", "ρος"]
>>> [Scansion()._long_by_position(syllable=syllable, sentence=syllables_sentence) for syllable in syllables_sentence]
[True, False, False, False, False]
_scansion(sentence_syllables)[source]

Replace long and short values for each input syllable.

Parameters:

sentence_syllables (List[List[str]]) – List of word tokens

Return type:

List[str]

Returns:

"˘" and "¯" to represent short and long syllables, respectively

>>> from cltk.prosody.grc import Scansion
>>> syllables_sentence = [["νε", "ος", "μεν", "και", "α", "πει", "ρος", "δι", "κων", "ε", "γω", "γε", "ε", "τι"], ["μεν", "και", "α", "πει", "ρος"]]
>>> Scansion()._scansion(syllables_sentence)
['˘¯¯¯˘¯¯˘¯˘¯˘˘x', '¯¯˘¯x']
_make_syllables(sentences_words)[source]

First tokenize, then divide word tokens into a list of syllables. Note that a syllable in this instance is defined as a vocalic group (i.e., vowel or a diphthong). This means that all syllables which are not the last syllable in the word will end with a vowel or diphthong.

Todo

  • Determine whether a CLTK syllabifier could replace this.

Parameters:

sentences_words (str) – Text string

Return type:

List[List[List[str]]]

Returns:

List of list of list of syllables

>>> from cltk.prosody.grc import Scansion
>>> text_string = "νέος μὲν καὶ ἄπειρος, δικῶν ἔγωγε ἔτι. μὲν καὶ ἄπειρος."
>>> Scansion()._make_syllables(text_string)
[[['νε', 'ος'], ['μεν'], ['και'], ['α', 'πει', 'ρος'], ['δι', 'κων'], ['ε', 'γω', 'γε'], ['ε', 'τι']], [['μεν'], ['και'], ['α', 'πει', 'ρος']]]

8.1.13.5. cltk.prosody.non module

Verse structures of Old Norse poetry

cltk.prosody.non.old_norse_normalize(text)[source]
>>> old_norse_normalize("Hvat er  þat?")
'hvat er þat'
Parameters:

text (str) – text to normalize

Return type:

str

Returns:

normalized text

class cltk.prosody.non.ShortLine(text)[source]

Bases: object

A short line, or half line, is a

property tokenized_text
syllabify(syllabifier)[source]
>>> raw_short_line = "Deyr fé"
>>> short_line = ShortLine(raw_short_line)
>>> syl = Syllabifier(language="non", break_geminants=True)
>>> syl.set_invalid_onsets(old_norse_syllabifier.invalid_onsets)
>>> short_line.syllabify(syl)
Parameters:

syllabifier – function that transforms a word into a list of its syllables

Returns:

to_phonetics(transcriber, with_squared_brackets=True)[source]

Phonetic transcription of the ShortLine instances. :param transcriber: Old Norse transcriber :param with_squared_brackets: :return:

property first_sounds

The first first sound of each word of the ShortLine. :return: first sound of each word

find_alliterations(other_short_line)[source]

Alliterations is the repetition of a same sound pattern (usually the first sound) of important words. This usually excludes stop words.

Parameters:

other_short_line – short line to compare with

Returns:

class cltk.prosody.non.LongLine(text)[source]

Bases: object

property tokenized_text
syllabify(syllabifier)[source]
>>> raw_long_line = "Deyr fé,\ndeyja frændr"
>>> short_line = ShortLine(raw_long_line)
>>> syl = Syllabifier(language="non", break_geminants=True)
>>> syl.set_invalid_onsets(old_norse_syllabifier.invalid_onsets)
>>> short_line.syllabify(syl)
Parameters:

syllabifier – Old Norse syllabifier

Returns:

to_phonetics(transcriber, with_squared_brackets=True)[source]

Phontic transcription of the ShortLine instances. :param transcriber: Old Norse transcriber :param with_squared_brackets: :return:

property first_sounds

The first first sound of each word of the ShortLine. :return:

find_alliterations()[source]

Alliterations is the repetition of a same sound pattern (usually the first sound) of important words. This usually excludes stop words. :return:

class cltk.prosody.non.Metre[source]

Bases: object

Verse, strophe or stanza. This is here a regular set of meters. ‘Abstract’ class which implements global methods on verse.

from_short_lines_text(text)[source]

Only implemented in daughter classes. :type text: str

syllabify(hierarchy)[source]

Syllables may play a role in verse classification.

to_phonetics(with_squared_brackets=True)[source]

Transcribing words in verse helps find alliteration.

find_alliteration()[source]

Find alliterations in the complete verse. :return:

class cltk.prosody.non.UnspecifiedStanza[source]

Bases: cltk.prosody.non.Metre

No specific structure. No find_alliteration because it makes only sense for long lines.

from_short_lines_text(text)[source]

Example from Völsupá 28

>>> stanza = "Ein sat hon úti,\nþá er inn aldni kom\nyggjungr ása\nok í augu leit.\nHvers fregnið mik?\nHví freistið mín?\nAllt veit ek, Óðinn,\nhvar þú auga falt,\ní inum mæra\nMímisbrunni.\nDrekkr mjöð Mímir\nmorgun hverjan\naf veði Valföðrs.\nVituð ér enn - eða hvat?"
>>> us = UnspecifiedStanza()
>>> us.from_short_lines_text(stanza)
>>> [sl.text for sl in us.short_lines]
['Ein sat hon úti,', 'þá er inn aldni kom', 'yggjungr ása', 'ok í augu leit.', 'Hvers fregnið mik?', 'Hví freistið mín?', 'Allt veit ek, Óðinn,', 'hvar þú auga falt,', 'í inum mæra', 'Mímisbrunni.', 'Drekkr mjöð Mímir', 'morgun hverjan', 'af veði Valföðrs.', 'Vituð ér enn - eða hvat?']
>>> us.long_lines
Parameters:

text (str) – raw text

Returns:

syllabify(hierarchy)[source]
>>> stanza = "Ein sat hon úti,\nþá er inn aldni kom\nyggjungr ása\nok í augu leit.\nHvers fregnið mik?\nHví freistið mín?\nAllt veit ek, Óðinn,\nhvar þú auga falt,\ní inum mæra\nMímisbrunni.\nDrekkr mjöð Mímir\nmorgun hverjan\naf veði Valföðrs.\nVituð ér enn - eða hvat?"
>>> us = UnspecifiedStanza()
>>> us.from_short_lines_text(stanza)
>>> us.syllabify(old_norse_syllabifier.hierarchy)
>>> us.syllabified_text
[[['ein'], ['sat'], ['hon'], ['út', 'i']], [['þá'], ['er'], ['inn'], ['al', 'dni'], ['kom']], [['yg', 'gjungr'], ['ás', 'a']], [['ok'], ['í'], ['aug', 'u'], ['leit']], [['hvers'], ['freg', 'nið'], ['mik']], [['hví'], ['freis', 'tið'], ['mín']], [['allt'], ['veit'], ['ek'], ['ó', 'ðinn']], [['hvar'], ['þú'], ['aug', 'a'], ['falt']], [['í'], ['i', 'num'], ['mær', 'a']], [['mí', 'mis', 'brun', 'ni']], [['drekkr'], ['mjöð'], ['mí', 'mir']], [['mor', 'gun'], ['hver', 'jan']], [['af'], ['veð', 'i'], ['val', 'föðrs']], [['vi', 'tuð'], ['ér'], ['enn'], ['eð', 'a'], ['hvat']]]
Parameters:

hierarchy (Dict[str, int]) – phonetic hierarchy

Returns:

to_phonetics(with_squared_brackets=True)[source]
>>> stanza = "Ein sat hon úti,\nþá er inn aldni kom\nyggjungr ása\nok í augu leit.\nHvers fregnið mik?\nHví freistið mín?\nAllt veit ek, Óðinn,\nhvar þú auga falt,\ní inum mæra\nMímisbrunni.\nDrekkr mjöð Mímir\nmorgun hverjan\naf veði Valföðrs.\nVituð ér enn - eða hvat?"
>>> us = UnspecifiedStanza()
>>> us.from_short_lines_text(stanza)
>>> us.to_phonetics(False)
>>> us.transcribed_text
[['ɛin', 'sat', 'hɔn', 'uːti'], ['θaː', 'ɛr', 'inː', 'aldni', 'kɔm'], ['ygːjunɣr', 'aːsa'], ['ɔk', 'iː', 'ɒuɣu', 'lɛit'], ['hvɛrs', 'frɛɣnið', 'mik'], ['hviː', 'frɛistið', 'miːn'], ['alːt', 'vɛit', 'ɛk', 'oːðinː'], ['hvar', 'θuː', 'ɒuɣa', 'falt'], ['iː', 'inum', 'mɛːra'], ['miːmisbrunːi'], ['drɛkːr', 'mjœð', 'miːmir'], ['mɔrɣun', 'hvɛrjan'], ['av', 'vɛði', 'valvœðrs'], ['vituð', 'eːr', 'ɛnː', 'ɛða', 'hvat']]
Returns:

find_alliteration()[source]

Alliterations in short lines make no sense.

>>> stanza = "Ein sat hon úti,\nþá er inn aldni kom\nyggjungr ása\nok í augu leit.\nHvers fregnið mik?\nHví freistið mín?\nAllt veit ek, Óðinn,\nhvar þú auga falt,\ní inum mæra\nMímisbrunni.\nDrekkr mjöð Mímir\nmorgun hverjan\naf veði Valföðrs.\nVituð ér enn - eða hvat?"
>>> us = UnspecifiedStanza()
>>> us.from_short_lines_text(stanza)
>>> us.to_phonetics()
>>> us.find_alliteration()
([], 0)
Returns:

class cltk.prosody.non.Fornyrdhislag[source]

Bases: cltk.prosody.non.Metre

Fornyrðislag has two lifts per half line, with two or three (sometimes one) unstressed syllables. At least two lifts, usually three, alliterate, always including the main stave (the first lift of the second half-line). (See https://en.wikipedia.org/wiki/Alliterative_verse#Old_Norse_poetic_forms)

from_short_lines_text(text)[source]

Famous example from Völsupá 1st stanza

>>> text = "Hljóðs bið ek allar\nhelgar kindir,\nmeiri ok minni\nmögu Heimdallar;\nviltu at ek, Valföðr,\nvel fyr telja\nforn spjöll fira,\nþau er fremst of man."
>>> fo = Fornyrdhislag()
>>> fo.from_short_lines_text(text)
>>> [sl.text for sl in fo.short_lines]
['Hljóðs bið ek allar', 'helgar kindir,', 'meiri ok minni', 'mögu Heimdallar;', 'viltu at ek, Valföðr,', 'vel fyr telja', 'forn spjöll fira,', 'þau er fremst of man.']
>>> [[sl.text for sl in long_line] for long_line in fo.long_lines]
[['Hljóðs bið ek allar', 'helgar kindir,'], ['meiri ok minni', 'mögu Heimdallar;'], ['viltu at ek, Valföðr,', 'vel fyr telja'], ['forn spjöll fira,', 'þau er fremst of man.']]
Parameters:

text (str) – raw text

Returns:

syllabify(hierarchy)[source]
>>> text = "Hljóðs bið ek allar\nhelgar kindir,\nmeiri ok minni\nmögu Heimdallar;\nviltu at ek, Valföðr,\nvel fyr telja\nforn spjöll fira,\nþau er fremst of man."
>>> fo = Fornyrdhislag()
>>> fo.from_short_lines_text(text)
>>> fo.syllabify(old_norse_syllabifier.hierarchy)
>>> fo.syllabified_text
[[[['hljóðs'], ['bið'], ['ek'], ['al', 'lar']], [['hel', 'gar'], ['kin', 'dir']]], [[['meir', 'i'], ['ok'], ['min', 'ni']], [['mög', 'u'], ['heim', 'dal', 'lar']]], [[['vil', 'tu'], ['at'], ['ek'], ['val', 'föðr']], [['vel'], ['fyr'], ['tel', 'ja']]], [[['forn'], ['spjöll'], ['fir', 'a']], [['þau'], ['er'], ['fremst'], ['of'], ['man']]]]
Parameters:

hierarchy (Dict[str, int]) – phonetic hierarchy

Returns:

to_phonetics(with_squared_brackets=True)[source]
>>> text = "Hljóðs bið ek allar\nhelgar kindir,\nmeiri ok minni\nmögu Heimdallar;\nviltu at ek, Valföðr,\nvel fyr telja\nforn spjöll fira,\nþau er fremst of man."
>>> fo = Fornyrdhislag()
>>> fo.from_short_lines_text(text)
>>> fo.to_phonetics(False)
>>> fo.transcribed_text
[[['hljoːðs', 'bið', 'ɛk', 'alːar'], ['hɛlɣar', 'kindir']], [['mɛiri', 'ɔk', 'minːi'], ['mœɣu', 'hɛimdalːar']], [['viltu', 'at', 'ɛk', 'valvœðr'], ['vɛl', 'fyr', 'tɛlja']], [['fɔrn', 'spjœlː', 'fira'], ['θɒu', 'ɛr', 'frɛmst', 'ɔv', 'man']]]
Returns:

find_alliteration()[source]
>>> text = "Hljóðs bið ek allar\nhelgar kindir,\nmeiri ok minni\nmögu Heimdallar;\nviltu at ek, Valföðr,\nvel fyr telja\nforn spjöll fira,\nþau er fremst of man."
>>> fo = Fornyrdhislag()
>>> fo.from_short_lines_text(text)
>>> fo.to_phonetics()
>>> fo.find_alliteration()
([[('hljóðs', 'helgar')], [('meiri', 'mögu'), ('minni', 'mögu')], [], [('forn', 'fremst'), ('fira', 'fremst')]], [1, 2, 0, 2])
Returns:

class cltk.prosody.non.Ljoodhhaattr[source]

Bases: cltk.prosody.non.Metre

Ljóðaháttr is a stanzaic verse form that created four line stanzas. The odd numbered lines were almost standard lines of alliterative verse with four lifts and two or three alliterations, with cæsura; the even numbered lines had three lifts and two alliterations, and no cæsura.

See https://en.wikipedia.org/wiki/Alliterative_verse#Lj%C3%B3%C3%B0ah%C3%A1ttr.

from_short_lines_text(text)[source]

Famous example from Hávamál 77

>>> text = "Deyr fé,\ndeyja frændr,\ndeyr sjalfr it sama,\nek veit einn,\nat aldrei deyr:\ndómr um dauðan hvern."
>>> lj = Ljoodhhaattr()
>>> lj.from_short_lines_text(text)
>>> [sl.text for sl in lj.short_lines]
['Deyr fé,', 'deyja frændr,', 'deyr sjalfr it sama,', 'ek veit einn,', 'at aldrei deyr:', 'dómr um dauðan hvern.']
>>> [[sl.text for sl in long_line] for long_line in lj.long_lines]
[['Deyr fé,', 'deyja frændr,'], ['deyr sjalfr it sama,'], ['ek veit einn,', 'at aldrei deyr:'], ['dómr um dauðan hvern.']]
Parameters:

text (str) –

Returns:

syllabify(hierarchy)[source]
>>> lj = Ljoodhhaattr()
>>> text = "Deyr fé,\ndeyja frændr,\ndeyr sjalfr it sama,\nek veit einn,\nat aldrei deyr:\ndómr um dauðan hvern."
>>> lj.from_short_lines_text(text)
>>> lj.syllabify(old_norse_syllabifier.hierarchy)
>>> lj.syllabified_text
[[[['deyr'], ['fé']], [['deyj', 'a'], ['frændr']]], [[['deyr'], ['sjalfr'], ['it'], ['sam', 'a']]], [[['ek'], ['veit'], ['einn']], [['at'], ['al', 'drei'], ['deyr']]], [[['dómr'], ['um'], ['dau', 'ðan'], ['hvern']]]]
Parameters:

hierarchy (Dict[str, int]) – phonetic hierarchy

Returns:

to_phonetics(with_squared_brackets=True)[source]
>>> lj = Ljoodhhaattr()
>>> text = "Deyr fé,\ndeyja frændr,\ndeyr sjalfr it sama,\nek veit einn,\nat aldrei deyr:\ndómr um dauðan hvern."
>>> lj.from_short_lines_text(text)
>>> lj.to_phonetics(False)
>>> lj.transcribed_text
[[['dɐyr', 'feː'], ['dɐyja', 'frɛːndr']], [['dɐyr', 'sjalvr', 'it', 'sama']], [['ɛk', 'vɛit', 'ɛinː'], ['at', 'aldrɛi', 'dɐyr']], [['doːmr', 'um', 'dɒuðan', 'hvɛrn']]]
find_alliteration()[source]
>>> poem = "Deyr fé,\ndeyja frændr,\ndeyr sjalfr it sama,\nek veit einn,\nat aldrei deyr:\ndómr um dauðan hvern."
>>> lj = Ljoodhhaattr()
>>> lj.from_short_lines_text(poem)
>>> lj.to_phonetics()
>>> verse_alliterations, n_alliterations_lines = lj.find_alliteration()
>>> verse_alliterations
[[('deyr', 'deyja'), ('fé', 'frændr')], [('sjalfr', 'sjalfr')], [('einn', 'aldrei')], [('dómr', 'um')]]
>>> n_alliterations_lines
[2, 1, 1, 1]
Return type:

Tuple[list, list]

Returns:

class cltk.prosody.non.MetreManager[source]

Bases: object

Handles different kinds of meter in Old Norse poetry.

  • Fornyrðislag

  • Ljóðaháttr

static is_fornyrdhislag(text)[source]

Basic check, only the number of lines matters: 8 for fornyrðislag.

>>> text1 = "Hljóðs bið ek allar\nhelgar kindir,\nmeiri ok minni\nmögu Heimdallar;\nviltu at ek, Valföðr,\nvel fyr telja\nforn spjöll fira,\nþau er fremst of man."
>>> text2 = "Deyr fé,\ndeyja frændr,\ndeyr sjalfr it sama,\nek veit einn,\nat aldrei deyr:\ndómr um dauðan hvern."
>>> MetreManager.is_fornyrdhislag(text1)
True
>>> MetreManager.is_fornyrdhislag(text2)
False
Parameters:

text (str) –

Return type:

bool

Returns:

static is_ljoodhhaattr(text)[source]

Basic check, only the number of lines matters: 6 for ljóðaháttr

>>> text1 = "Hljóðs bið ek allar\nhelgar kindir,\nmeiri ok minni\nmögu Heimdallar;\nviltu at ek, Valföðr,\nvel fyr telja\nforn spjöll fira,\nþau er fremst of man."
>>> text2 = "Deyr fé,\ndeyja frændr,\ndeyr sjalfr it sama,\nek veit einn,\nat aldrei deyr:\ndómr um dauðan hvern."
>>> MetreManager.is_ljoodhhaattr(text1)
False
>>> MetreManager.is_ljoodhhaattr(text2)
True
Parameters:

text (str) –

Return type:

bool

Returns:

static load_poem_from_paragraphs(paragraphs)[source]

Deals with a list of paragraphs: - detects its category, - processes it.

>>> text1 = "Hljóðs bið ek allar\nhelgar kindir,\nmeiri ok minni\nmögu Heimdallar;\nviltu at ek, Valföðr,\nvel fyr telja\nforn spjöll fira,\nþau er fremst of man."
>>> text2 = "Deyr fé,\ndeyja frændr,\ndeyr sjalfr it sama,\nek veit einn,\nat aldrei deyr:\ndómr um dauðan hvern."
>>> paragraphs = [text1, text2]
>>> poem = MetreManager.load_poem_from_paragraphs(paragraphs)
>>> isinstance(poem[0], Fornyrdhislag)
True
>>> isinstance(poem[1], Ljoodhhaattr)
True
Parameters:

paragraphs (List[str]) – list of stanzas (list of strings)

Returns:

list of Fornyrdhislag or Ljoodhhaattr instances