cemaleker / conj

Python conjugation module for Turkish

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

conj

PyPI version Build Status Coverage Status Code Health GPL Licence

Python conjugation module for Turkish.

Installation

$ pip install conj

Usage Example

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

Supported Python Versions

  • python 3
  • python 2
  • pypy3
  • pypy

Running Tests

To run tests, you have to install unittest first:

$ pip install unittest

Then, just run tests.py:

$ python tests.py

API Reference

conj

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

Conjugation Types

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

Contributors

Contributing

  • You can open an issue or send pull request about my faults.
  • You can add new conjugation types via sending pull request.

License

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/>.

See Full License

About

Python conjugation module for Turkish

License:GNU General Public License v3.0


Languages

Language:Python 100.0%