lingpy.tests.sequence package

Submodules

lingpy.tests.sequence.test_generate module

class lingpy.tests.sequence.test_generate.Tests(methodName='runTest')

Bases: unittest.case.TestCase

setUp()

Hook method for setting up the test fixture before exercising it.

test_evaluate_string()
test_get_string()

lingpy.tests.sequence.test_ngrams module

class lingpy.tests.sequence.test_ngrams.Tests(methodName='runTest')

Bases: unittest.case.TestCase

setUp()

Hook method for setting up the test fixture before exercising it.

test_all_ngrams()
test_bigrams()
test_fourgrams()
test_get_all_ngrams_by_order()
test_get_all_posngrams()
test_get_n_grams()
test_get_posngrams()
test_get_skipngrams()
test_ngram_class()
test_trigrams()
lingpy.tests.sequence.test_ngrams.bigrams(sequence, *, order=2, pad_symbol='$$$')

Build an iterator for collecting all bigrams of a sequence.

The sequence is padded by default.

Parameters:

sequence: list or str :

The sequence from which the bigrams will be collected.

pad_symbol: object :

An optional symbol to be used as start-of- and end-of-sequence boundaries. The same symbol is used for both boundaries. Must be a value different from None, defaults to “$$$”.

Returns:

out: iterable :

An iterable over the bigrams of the sequence, returned as tuples.

Examples

>>> from lingpy.sequence import *
>>> sent = "Insurgents killed in ongoing fighting"
>>> for ngram in bigrams(sent):
...     print(ngram)
...
('$$$', 'Insurgents')
('Insurgents', 'killed')
('killed', 'in')
('in', 'ongoing')
('ongoing', 'fighting')
('fighting', '$$$')
lingpy.tests.sequence.test_ngrams.fourgrams(sequence, *, order=4, pad_symbol='$$$')

Build an iterator for collecting all fourgrams of a sequence.

The sequence is padded by default.

Parameters:

sequence: list or str :

The sequence from which the fourgrams will be collected.

pad_symbol: object :

An optional symbol to be used as start-of- and end-of-sequence boundaries. The same symbol is used for both boundaries. Must be a value different from None, defaults to “$$$”.

Returns:

out: iterable :

An iterable over the fourgrams of the sequence, returned as tuples.

Examples

>>> from lingpy.sequence import *
>>> sent = "Insurgents killed in ongoing fighting"
>>> for ngram in fourgrams(sent):
...     print(ngram)
...
('$$$', '$$$', '$$$', 'Insurgents')
('$$$', '$$$', 'Insurgents', 'killed')
('$$$', 'Insurgents', 'killed', 'in')
('Insurgents', 'killed', 'in', 'ongoing')
('killed', 'in', 'ongoing', 'fighting')
('in', 'ongoing', 'fighting', '$$$')
('ongoing', 'fighting', '$$$', '$$$')
('fighting', '$$$', '$$$', '$$$')
lingpy.tests.sequence.test_ngrams.trigrams(sequence, *, order=3, pad_symbol='$$$')

Build an iterator for collecting all trigrams of a sequence.

The sequence is padded by default.

Parameters:

sequence: list or str :

The sequence from which the trigrams will be collected.

pad_symbol: object :

An optional symbol to be used as start-of- and end-of-sequence boundaries. The same symbol is used for both boundaries. Must be a value different from None, defaults to “$$$”.

Returns:

out: iterable :

An iterable over the trigrams of the sequence, returned as tuples.

Examples

>>> from lingpy.sequence import *
>>> sent = "Insurgents killed in ongoing fighting"
>>> for ngram in trigrams(sent):
...     print(ngram)
...
('$$$', '$$$', 'Insurgents')
('$$$', 'Insurgents', 'killed')
('Insurgents', 'killed', 'in')
('killed', 'in', 'ongoing')
('in', 'ongoing', 'fighting')
('ongoing', 'fighting', '$$$')
('fighting', '$$$', '$$$')

lingpy.tests.sequence.test_profile module

class lingpy.tests.sequence.test_profile.Tests(methodName='runTest')

Bases: unittest.case.TestCase

setUp()

Hook method for setting up the test fixture before exercising it.

test_context_profile()
test_simple_profile()

lingpy.tests.sequence.test_smoothing module

class lingpy.tests.sequence.test_smoothing.Tests(methodName='runTest')

Bases: unittest.case.TestCase

setUp()

Hook method for setting up the test fixture before exercising it.

test_certaintydegree_dist()

Test for the Degree of Certainty distribution.

test_ele_dist()

Test for the Expected-Likelihood estimation distribution.

test_laplace_dist()

Test for the Laplace distribution.

test_mle_dist()

Test for the Maximum-Likelihood Estimation distribution.

test_random_dist()

Test for the random distribution.

test_sgt_dist()

Test for the Simple Good-Turing distribution.

test_uniform_dist()

Test for the uniform distribution.

test_wittenbell_dist()

Test for the Witten-Bell distribution.

lingpy.tests.sequence.test_sound_classes module

class lingpy.tests.sequence.test_sound_classes.Tests(methodName='runTest')

Bases: unittest.case.TestCase

setUp()

Hook method for setting up the test fixture before exercising it.

test_check_tokens()
test_class2tokens()
test_clean_string()
test_codepoint()
test_ipa2tokens()
test_onoparse()
test_pgrams()
test_pid()
test_prosodic_string()
test_prosodic_weights()
test_sampa2uni()
test_syllabify()
test_token2class()
test_tokens2class()
test_tokens2morphemes()

Module contents