Tools for doing phonology analysis.
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
phontext-0.0.2.tar.gz
(17.0 kB
view details)
Built Distribution
phontext-0.0.2-py3-none-any.whl
(17.5 kB
view details)
File details
Details for the file phontext-0.0.2.tar.gz
.
File metadata
- Download URL: phontext-0.0.2.tar.gz
- Upload date:
- Size: 17.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d49150ea828cb4c660b0fade34551985833018913561408cd4a2d408cbb63179 |
|
MD5 | 3a6d2056bf8423c1553e65c808c60f28 |
|
BLAKE2b-256 | b4e440da2d52e86fbd93287bb89e64e1d7524f24112b0d4c76261f911b29db90 |
File details
Details for the file phontext-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: phontext-0.0.2-py3-none-any.whl
- Upload date:
- Size: 17.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 80f4f85398950e765da37bdb33aa5dc5100091de84462ef0bca323e4bb5b5403 |
|
MD5 | 42ac871ddfbb0760511566fb8c6342b2 |
|
BLAKE2b-256 | d2568b550bb4e66956ce0cefbb93b68530364bf1de8acc1c9bf15bf2ed44df14 |