Skip to main content

tdk-py

Python API for the Turkish Language Foundation

Latest version on PyPI Supported Python versions

Codacy Grade Badge Codacy Coverage Badge checks/master docs


tdk-py is a Python package allowing access to Turkish dictionaries of the TDK, the Turkish Language Association.

tdk-py provides both synchronous and asynchronous interfaces to the TDK's APIs and parses their responses into Python class objects based on Pydantic, so you can do things like .model_dump_json() them, or use them in your API endpoints and generate beautiful schemas.

Quick start

tdk-py is supported on Python 3.10+. First, make sure you have a Python environment set up.

# in the shell
poetry add tdk-py      # if using python-poetry.org (recommended)
pipenv install tdk-py  # if using pipenv.pypa.io
pip install tdk-py     # straight pip.pypa.io
# in Python
import tdk

Examples

import tdk

results = tdk.search_gts_sync("merkeziyetçilik")
print(results[0].meanings[0].meaning)
Otoritenin ve işin tek bir merkezde toplanmasını amaçlayan görüş; merkeziyet, merkezcilik

You can query suggestions for misspelt words or for other similar words.

from difflib import get_close_matches
import tdk

# Calculate suggestions locally using the index:
words = get_close_matches("feldispat", tdk.get_gts_index_sync())
assert words == ['feldspat', 'ispat', 'fesat']

# Use the TDK API: (sometimes errors out)
words = tdk.get_gts_suggestions_sync("feldispat")
assert words == ['feldspat', 'felekiyat', 'ispat']

You can perform complex analyses very easily. Let's see the distribution of entries by the number of maximum consecutive consonants.

import tdk

annotated_dict = {}
for entry in tdk.get_gts_index_sync():
    streaks = tdk.tools.max_streak(entry)
    if streaks not in annotated_dict:
        annotated_dict[streaks] = [entry]
    else:
        annotated_dict[streaks].append(entry)
for i in set(annotated_dict):
    print(i, len(annotated_dict[i]))
0 19
1 15199
2 73511
3 3605
4 68
5 5

License

tdk-py's source code is provided under the MIT License

Copyright © 2021-2026 Emre Özcan

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tdk_py-2.0.1.tar.gz (22.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tdk_py-2.0.1-py3-none-any.whl (30.6 kB view details)

Uploaded Python 3

File details

Details for the file tdk_py-2.0.1.tar.gz.

File metadata

  • Download URL: tdk_py-2.0.1.tar.gz
  • Upload date:
  • Size: 22.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for tdk_py-2.0.1.tar.gz
Algorithm Hash digest
SHA256 e4e03133d1009e339bcb91aca1bf78e45b43ff71ee5b990ce04d3b079d099fa0
MD5 9ed23e97237d9020f302b0da3c821437
BLAKE2b-256 5305ab10aeab208788b2512d1864d9163b83e90211f3e2d8cb7c9eccc3d945e6

See more details on using hashes here.

Provenance

The following attestation bundles were made for tdk_py-2.0.1.tar.gz:

Publisher: publish.yml on emreozcan/tdk-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tdk_py-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: tdk_py-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 30.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for tdk_py-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cf25c98ec784e35b5f8786b206c734d3cd964e79087f046f57f3d0ee9e7c467b
MD5 7b6aead6c527ad496f60537b3927b332
BLAKE2b-256 a2fc22d3a8922be9b85d7f4358dd5cf641240e8c5c1a181648f69a28923d4977

See more details on using hashes here.

Provenance

The following attestation bundles were made for tdk_py-2.0.1-py3-none-any.whl:

Publisher: publish.yml on emreozcan/tdk-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

2.0.1 This release

2 files

2.0.0

2 files

1.3.0

2 files

1.2.0

2 files

1.1.1

2 files

1.1.0.post1

2 files

1.1.0

2 files

1.0.0.post1

2 files

0.2.0

2 files

0.1.1

2 files

0.1.0.post1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page