LingPy

This documentation is for version 2.0.dev, which is not released yet.

lingpy.sequence.sound_classes.class2tokens

lingpy.sequence.sound_classes.class2tokens(tokens, classes, gap_char='-', local=False)

Turn aligned sound-class sequences into an aligned sequences of IPA tokens.

Parameters :

tokens : list

The list of tokens corresponding to the unaligned IPA string.

classes : string or list

The aligned class string.

gap_char : string (default=”-”)

The character which indicates gaps in the output string.

local : bool (default=False)

If set to True a local alignment with prefix and suffix can be converted.

Returns :

alignment : list

A list of tokens with gaps at the positions where they occured in the alignment of the class string.

Examples

>>> from lingpy import *
>>> tokens = ipa2tokens('t͡sɔyɡə')
>>> aligned_sequence = 'CU-KE'
>>> print ', '.join(class2tokens(tokens,aligned_sequence))
t͡s, ɔy, -, ɡ, ə

This Page