Coverage for lingpy/sequence/generate.py : 100%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
""" Module provides simple basic classes for sequence generation using Markov models. """
""" Basic class for creating Markov chains from sequence training data.
Parameters ---------- seq : list A list of sequences. Sequences are assumed to be tokenized, i.e. they should be either passed as lists or as tuples.
"""
# create distribution
""" Create random sequence from the distribution. """
# get the start sequence
# check for terminal symbol
""" Class for the creation of phonetic sequences ("pseudo words").
Parameters ---------- words : list List of phonetic sequences. This list can contain tokenized sequences (lists or tuples), or simple untokenized IPA strings.
tokens : bool (default=False) If set to True, no tokenization of input sequences is carried out.
prostring : list (default=[]) List containing the prosodic profiles of the input sequences. If the list is empty, the profiles are generated automatically.
"""
self, words, tokens=False, prostrings=[], classes=False, class_model=rcParams['model'], **keywords ): diacritics=rcParams['diacritics'], cldf=False)
# start filling the dictionary
# check for tokenized string else:
# create prosodic string else: tk, rcParams['art'], cldf=keywords['cldf'], diacritics=keywords['diacritics'], stress=keywords['stress']) # create classes diacritics=keywords['diacritics'], stress=keywords['stress']) else: # zip the stuff
# start appending the stuff
# init the mother object
""" Generate a string from the Markov chain created from the training data.
Parameters ---------- new : bool (default=True) Determine whether the string created should be different from the training data or not. tokens : bool (default=False) If set to *True* he full list of tokens that was internally used to represent the sequences as a Markov chain is returned. """
# create the first string
else:
else:
diacritics=rcParams['diacritics'], cldf=False)
diacritics=keywords['diacritics'], stress=keywords['stress']) diacritics=keywords['diacritics'], stress=keywords['stress']) else:
|