Skip to content

Arithmetic for Phones and Features

In [1]:
from phones import PhoneCollection
pc = PhoneCollection()

Phones in this library support arithmetic operations. Please note that this is fairly slow when not filtering by language and/or dialect.

In [2]:
(pc.phones("ø").val + pc.phones("o").val)[0]
Out[2]:
(1.0, eo (bhg))

PhoneFeatures

Using a PhoneFeature, individual features can be altered.

In [3]:
from phones.features import PhoneFeature
In [4]:
(pc.phones("ʉ").val + PhoneFeature("back", 1))[0]
Out[4]:
(0.0, ʉu (fao))
In [5]:
(pc.phones("ʉ").val - PhoneFeature("round", 1))[0]
Out[5]:
(1.0, ɨ̜ (kid))

Listing Features

In [6]:
pc.features
Out[6]:
['advancedTongueRoot',
 'anterior',
 'approximant',
 'back',
 'click',
 'consonantal',
 'constrictedGlottis',
 'continuant',
 'coronal',
 'delayedRelease',
 'distributed',
 'dorsal',
 'epilaryngealSource',
 'fortis',
 'front',
 'high',
 'labial',
 'labiodental',
 'lateral',
 'long',
 'low',
 'loweredLarynxImplosive',
 'nasal',
 'periodicGlottalSource',
 'raisedLarynxEjective',
 'retractedTongueRoot',
 'round',
 'short',
 'sonorant',
 'spreadGlottis',
 'stress',
 'strident',
 'syllabic',
 'tap',
 'tense',
 'tone',
 'trill']