Python API for the Turkish Language Foundation
Project description
tdk-py
Python API for the Turkish Language Foundation
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-2025 Emre Özcan
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tdk_py-2.0.0.tar.gz.
File metadata
- Download URL: tdk_py-2.0.0.tar.gz
- Upload date:
- Size: 22.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85686fe3e15b967c99841987d7685c09139591ffe5f8d9b247c87cbb920773fb
|
|
| MD5 |
d751acda211bbccf9cde899466810e40
|
|
| BLAKE2b-256 |
1fae6dac29ce773dacede9f832d5f7c9c11e8a12abfefd51206e6aaadb31e4ae
|
Provenance
The following attestation bundles were made for tdk_py-2.0.0.tar.gz:
Publisher:
publish.yml on emreozcan/tdk-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tdk_py-2.0.0.tar.gz -
Subject digest:
85686fe3e15b967c99841987d7685c09139591ffe5f8d9b247c87cbb920773fb - Sigstore transparency entry: 228359922
- Sigstore integration time:
-
Permalink:
emreozcan/tdk-py@afb45b31911b1cc2257cbfbb373c72ce1517c0d9 -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/emreozcan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@afb45b31911b1cc2257cbfbb373c72ce1517c0d9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file tdk_py-2.0.0-py3-none-any.whl.
File metadata
- Download URL: tdk_py-2.0.0-py3-none-any.whl
- Upload date:
- Size: 30.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e5db030729fc1e103b2ad2e51a4ec1f68a1b95c26c52a9d411b76508ed1dbef
|
|
| MD5 |
cdb18487cb9ee4fa33c926bf11748a5a
|
|
| BLAKE2b-256 |
f4d29a2331580e4dbc1ce2b0b1b384f99d09405a6964767b003a0a7ae055f8e8
|
Provenance
The following attestation bundles were made for tdk_py-2.0.0-py3-none-any.whl:
Publisher:
publish.yml on emreozcan/tdk-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tdk_py-2.0.0-py3-none-any.whl -
Subject digest:
0e5db030729fc1e103b2ad2e51a4ec1f68a1b95c26c52a9d411b76508ed1dbef - Sigstore transparency entry: 228359924
- Sigstore integration time:
-
Permalink:
emreozcan/tdk-py@afb45b31911b1cc2257cbfbb373c72ce1517c0d9 -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/emreozcan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@afb45b31911b1cc2257cbfbb373c72ce1517c0d9 -
Trigger Event:
push
-
Statement type: