PhonText
A python package for phonology analysis from text files
Installation
Use the package manager pip to install phontext.
pip install phontext
Usage
Working with words
from phontext import Word
config = {
'vowels': ['a', 'e', 'i', 'o', 'u'],
'consonants': ['p', 't', 'k', 'ch', 'ts', 'rr', 'r']
}
# Parse words into segments
word = Word('chincha', **config)
len(word)
>> 5
word.cv
>> CVCCV
word.word_str
>> ch i n ch a
word.word
>> ["ch", "i","n", "ch", "a"]
# Find minimal pairs
word1 = Word('tasa', **config)
word2 = Word('kasa', **config)
word3 = Word('tasl', **config)
word1.is_minimal_pair(word2)
>> True
word1.is_minimal_pair(word3)
>> False
# and much more...
Working with wordlist
from phontext import Corpus
words = ['perro', 'pero', 'piso', 'peso']
config = {
'vowels': ['a', 'e', 'i', 'o', 'u'],
'consonants': ['p', 't', 'k', 'ch', 'ts', 'rr', 'r']
}
corpus = Corpus(**config)
for word_str in words:
corpus.append(word_str)
segment_stat = corpus.get_segment_frequency()
segment_stat
>> {
'vowels': {
'e':3,
'i':1
}
'consonants':{
'p':4,
'rr':1
}
'others':
's':2,
'r':1
}
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
License
Metadata
Release files for phontext 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| phontext-0.0.2.tar.gz | 17.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| phontext-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 34.5 kB
Release files / phontext-0.0.2.tar.gz
| Download URL | phontext-0.0.2.tar.gz |
|---|---|
| Size | 17.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d49150ea828cb4c660b0fade34551985833018913561408cd4a2d408cbb63179
|
|
BLAKE2b-256 checksum How to use checksums |
b4e440da2d52e86fbd93287bb89e64e1d7524f24112b0d4c76261f911b29db90
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Release files / phontext-0.0.2-py3-none-any.whl
| Download URL | phontext-0.0.2-py3-none-any.whl |
|---|---|
| Size | 17.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
80f4f85398950e765da37bdb33aa5dc5100091de84462ef0bca323e4bb5b5403
|
|
BLAKE2b-256 checksum How to use checksums |
d2568b550bb4e66956ce0cefbb93b68530364bf1de8acc1c9bf15bf2ed44df14
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|