Python conjugation module for Turkish.
$ pip install conj
from conj import conj
print(conj('İstanbul', True, 'den')) # output: İstanbul'dan
print(conj('Muş', True, 'de')) # output: Muş'ta
# -----------------------------------------------------------
import random
title = "%(name)s %(punishment)s şoku"
names = ['Guido', 'Merkel', 'Voyvoda']
punishments = ['Hapis', 'Kazık']
print title % {
"name": conj(random.choice(names), True, 'e'),
"punishment": random.choice(punishments)
}
# output: Guido'ya hapis şoku
# output: Merkel'e hapis şoku
# output: Voyvodo'ya kazık şoku
- python 3
- python 2
- pypy3
- pypy
To run tests, you have to install unittest first:
$ pip install unittest
Then, just run tests.py:
$ python tests.py
conj(word, properName=False, conjType='dative')
- word (String): Word you want to conjugate.
- properName (Boolean): Determining if the word is a proper name to put apostrophe.
- conjType (String): Conjugation type:
- dative
- accusative
- adessive
- ablative
- derivative
- abesive
- genitive
- plural
- mastar
conjType | shortcut | desc | example |
---|---|---|---|
dative | e | -e hâli (yönelme hâli) | İstanbul'a |
accusative | i | -i hâli (belirtme hâli) | İstanbul'u |
adessive | de | -de hâli (bulunma hâli) | İstanbul'da |
ablative | den | -den hâli (ayrılma hâli) | İstanbul'dan |
derivative | li | -li hâli (köken) | İstanbullu |
abesive | siz | -siz hâli (gıyapta) | İstanbul'suz |
genitive | in | -in hâli (âidiyet, ilişki) | İstanbul'un |
plural | ler | çoğul hâl | İstanbul'lar |
mastar | mek | -mek, -mak (mastar eki) | gezmek |
- You can open an issue or send pull request about my faults.
- You can add new conjugation types via sending pull request.
Python conjugation module for Turkish.
Copyright (C) 2016 Halil Kaya
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.