Sound Class Models (Model)

class lingpy.data.model.Model(model, path=None)

Class for the handling of sound-class models.

Parameters

model : { ‘sca’, ‘dolgo’, ‘asjp’, ‘art’, ‘_color’ }

A string indicating the name of the model which shall be loaded. Select between:

  • ‘sca’ - the SCA sound-class model (see List2012a),

  • ‘dolgo’ - the DOLGO sound-class model (see: :evobib:`Dolgopolsky1986’),

  • ‘asjp’ - the ASJP sound-class model (see Brown2008 and Brown2011),

  • ‘art’ - the sound-class model which is used for the calculation of sonority profiles and prosodic strings (see List2012), and

  • ‘_color’ - the sound-class model which is used for the coloring of sound-tokens when creating html-output.

Notes

Models are loaded from binary files which can be found in the data/models/ folder of the LingPy package. A model has two essential attributes:

  • converter – a dictionary with IPA-tokens as keys and sound-class characters as values, and

  • scorer – a scoring dictionary with tuples of sound-class characters as keys and scores (integers or floats) as values.

Examples

When loading LingPy, the models sca, asjp, dolgo, and art are automatically loaded, and they are accessible via the rc() function for global settings:

>>> from lingpy import *
>>> rc('asjp')
<sca-model "asjp">

Define variables for the standard models for convenience:

>>> asjp = rc('asjp')
>>> sca = rc('sca')
>>> dolgo = rc('dolgo')
>>> art = rc('art')

Check how the letter a is converted in the various models:

>>> for m in [asjp,sca,dolgo,art]:
...     print('{0} > {1} ({2})'.format('a',m.converter['a'],m.name))
...
a > a (asjp)
a > A (sca)
a > V (dolgo)
a > 7 (art)

Retrieve basic information of a given model:

>>> print(sca)
Model:    sca
Info:     Extended sound class model based on Dolgopolsky (1986)
Source:   List (2012)
Compiler: Johann-Mattis List
Date:     2012-03

Attributes

converter

dict

A dictionary with IPA tokens as keys and sound-class characters as values.

scorer

dict

A scoring dictionary with tuples of sound-class characters as keys and similarity scores as values.

info

dict

A dictionary storing the key-value pairs defined in the INFO.

name

str

The name of the model which is identical with the name of the folder from wich the model is loaded.