- class lingpy.compare.partial.Partial(infile, **keywords)¶
Extended class for automatic detection of partial cognates.
filename : str
The name of the file that shall be loaded.
The sound-class model that shall be used for the analysis. Defaults to the SCA sound-class model.
merge_vowels : bool (default=True)
Indicate whether consecutive vowels should be merged into single tokens or kept apart as separate tokens.
transform : dict
A dictionary that indicates how prosodic strings should be simplified (or generally transformed), using a simple key-value structure with the key referring to the original prosodic context and the value to the new value. Currently, prosodic strings (see
prosodic_string()) offer 11 different prosodic contexts. Since not all these are helpful in preliminary analyses for cognate detection, it is useful to merge some of these contexts into one. The default settings distinguish only 5 instead of 11 available contexts, namely:
Cfor all consonants in prosodically ascending position,
cfor all consonants in prosodically descending position,
Vfor all vowels,
Tfor all tones, and
Make sure to check also the “vowel” keyword when initialising a LexStat object, since the symbols you use for vowels and tones should be identical with the ones you define in your transform dictionary.
vowels : str (default=”VT_”)
For scoring function creation using the
get_scorerfunction, you have the possibility to use reduced scores for the matching of tones and vowels by modifying the “vscale” parameter, which is set to 0.5 as a default. In order to make sure that vowels and tones are properly detected, make sure your prosodic string representation of vowels matches the one in this keyword. Thus, if you change the prosodic strings using the “transform” keyword, you also need to change the vowel string, to make sure that “vscale” works as wanted in the
check : bool (default=False)
If set to True, the input file will first be checked for errors before the calculation is carried out. Errors will be written to the file errors, defaulting to
errors.log. See also
apply_checks : bool (default=False)
If set to True, any errors identified by check will be handled silently.
no_bscorer: bool (default=False) :
If set to True, this will suppress the creation of a language-specific scoring function (which may become quite large and is additional ballast if the method “lexstat” is not used after all. If you use the “lexstat” method, however, this needs to be set to False.
errors : str
The name of the error log.
This method automatically infers partial cognate sets from data which was previously morphologically segmented.
A dictionary with tuples of language names as key and indices as value, pointing to unique combinations of words with the same meaning in all language pairs.
The sound class model instance which serves to convert the phonetic data into sound classes.
A list of all unique language-specific character types in the instantiated LexStat object. The characters in this list consist of
the language identifier (numeric, referenced as “langid” as a default, but customizable via the keyword “langid”)
the sound class symbol for the respective IPA transcription value
the prosodic class value
All values are represented in the above order as one string, separated by a dot. Gaps are also included in this collection. They are traditionally represented as “X” for the sound class and “-” for the prosodic string.
A list containing all unique character types across languages. In contrast to the chars-attribute, the “rchars” (raw chars) do not contain the language identifier, thus they only consist of two values, separated by a dot, namely, the sound class symbol, and the prosodic class value.
A collection of
ScoreDictobjects, which are used to score the strings. LexStat distinguishes two different scoring functions:
rscorer: A “raw” scorer that is not language-specific and consists only of sound class values and prosodic string values. This scorer is traditionally used to carry out the first alignment in order to calculate the language-specific scorer. It is directly accessible as an attribute of the LexStat class (
rscorer). The characters which constitute the values in this scorer are accessible via the “rchars” attribue of each lexstat class.
bscorer: The language-specific scorer. This scorer is made of unique language-specific characters. These are accessible via the “chars” attribute of each LexStat class. As the “rscorer”, the “bscorer” can also be accessed directly as an attribute of the LexStat class (
Create a scoring function based on sound correspondences.
partial_cluster([method, threshold, scale, …])
Cluster the words into partial cognate sets.
add_cognate_ids(source, target[, idtype, …])
Compute normal cognate identifiers from partial cognate sets.
Inherited LexStat Methods
align_pairs(idxA, idxB[, concept])
Align all or some words of a given pair of languages.
cluster([method, cluster_method, threshold, …])
Function for flat clustering of words into cognate sets.
get_distances([method, mode, gop, scale, …])
Method calculates different distance estimates for language pairs.
get_random_distances([method, runs, mode, …])
Method calculates randoms scores for unrelated words in a dataset.
Create a scoring function based on sound correspondences.
Write data to file.
Inherited WordList Methods
Return all entries matching the given entry-type as a two-dimensional list.
add_entries(entry, source, function[, override])
Add new entry-types to the word list by modifying given ones.
calculate(data[, taxa, concepts, ref])
Function calculates specific data.
export(fileformat[, sections, entries, …])
Export the wordlist to specific fileformats.
get_dict([col, row, entry])
Function returns dictionaries of the cells matched by the indices.
get_etymdict([ref, entry, modify_ref])
Return an etymological dictionary representation of the word list.
get_list([row, col, entry, flat])
Function returns lists of rows and columns specified by their name.
get_paps([ref, entry, missing, modify_ref])
Function returns a list of present-absent-patterns of a given word list.
Write wordlist to file.
renumber(source[, target, override])
Renumber a given set of string identifiers by replacing the ids by integers.