Advanced Node.js module for accessing Turkish Language Institution (TDK) official dictionary data with advanced features like wildcard search, spell checking, daily word, and more!
- β Asterisk/Wildcard Search - Advanced pattern matching
- β Spell Checking - Real-time Turkish spell checking with suggestions
- β Daily Word - Get word of the day with meaning
- β Proverbs & Idioms - Separate proverb/idiom search functionality
- β Similar Words - Find semantically similar words
- β Letter-based Search - Find words by starting letter
- β Popular Searches - Get most searched words
- β Random Word - Discover random Turkish words
- β Pronunciation - Word pronunciation and audio support
- β Caching System - Performance optimization with cache
- β Rate Limiting - API protection
- β Batch Operations - Multiple word search
- β Health Check - System monitoring
- β Advanced Error Handling - Better error messages
- β API Server - Built-in Express.js server
npm install creart-tdk
# or
yarn add creart-tdkconst TDKSozluk = require('creart-tdk');
// Create instance
const tdk = new TDKSozluk();
// Search word
const result = await tdk.ara('merhaba');
console.log(result.data.kelime); // "merhaba"
console.log(result.data.anlamlar); // Meanings array// Wildcard search: "k?tap" finds words like "kitap", "katap"
const wildcardResult = await tdk.asteriskAra('k?tap');
// Multiple unknowns: "k???p" finds 5-letter words
const multiResult = await tdk.asteriskAra('k???p');
// Length specific: "k*p,5" finds 5-letter k...p words
const lengthResult = await tdk.asteriskAra('k*p,5');const spellCheck = await tdk.yazimDenetimi('TΓΌrkΓ§e yazΔ±m ΓΆreneΔi');
console.log(spellCheck.data.istatistik.dogrulukOrani); // 75%
console.log(spellCheck.data.sonuclar[3].oneriler); // ["ΓΆrneΔi", "ΓΆrnek", "ΓΆren"]const TDKSozluk = require('creart-tdk');
const tdk = new TDKSozluk({
cache: true,
timeout: 15000
});
// Word search with all features
const wordResult = await tdk.ara('kitap', {
telaffuz: true, // Include pronunciation
cacheTTL: 3600 // Cache for 1 hour
});
// Get today's word
const dailyWord = await tdk.gununKelimesi();
// Spell check
const spellCheck = await tdk.yazimDenetimi('Merhaba dΓΌnya!');
// Find proverbs
const proverbs = await tdk.atasozuAra('aΔaΓ§');
// Find similar words
const similar = await tdk.benzerKelimeler('sevgi', 5);
// Find words by letter
const letterWords = await tdk.harfeGoreKelimeler('a', 1, 10);
// Get popular searches
const popular = await tdk.populerAramalar(10);
// Get random word
const random = await tdk.rastgeleKelime();
// Get pronunciation
const pronunciation = await tdk.sesGetir('merhaba');const { createServer } = require('creart-tdk');
// Start API server
createServer({
port: 3000,
apiPath: '/api/v1',
corsOrigin: 'https://yourdomain.com',
rateLimitMax: 100,
tdk: {
cache: true,
timeout: 20000
}
});When running as a server, these endpoints are available:
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/kelime/:kelime |
Word search with details |
GET |
/api/asterisk/:pattern |
NEW! Asterisk pattern search |
GET |
/api/gunun-kelimesi |
Word of the day |
POST |
/api/yazim-denetimi |
Spell checking |
GET |
/api/atasozu/:anahtar |
Proverbs and idioms |
GET |
/api/benzer/:kelime |
Similar words |
GET |
/api/harf/:harf |
Words by letter |
GET |
/api/populer |
Popular searches |
GET |
/api/rastgele |
Random word |
GET |
/api/ses/:kelime |
Pronunciation |
POST |
/api/batch |
Batch word search |
GET |
/api/health |
Health check |
GET |
/api/cache/stats |
Cache statistics |
DELETE |
/api/cache |
Clear cache |
const tdk = new TDKSozluk({
baseURL: 'https://sozluk.gov.tr/',
timeout: 15000, // Request timeout
retryCount: 3, // Retry attempts
cache: true, // Enable caching
// ... other options
});const result = await tdk.ara('kelime', {
telaffuz: true, // Include pronunciation
cacheTTL: 1800, // Cache time in seconds
// Advanced options...
});k?tap β Matches: "kitap", "katap", "kutap"
k???p β Matches 5-letter words: "kalΔ±p", "kΓΌnyep"
a*a β Matches: "ada", "araba", "aΕkla"
k*p,5 β Matches 5-letter words: "kalΔ±p", "kavup"
?e?me β Matches: "gelme", "deΔme", "seΓ§me"
?- Any single character*- Any number of characters (including zero),- Length specifier (e.g.,,5for 5 letters)- Case insensitive
- Turkish character support
{
success: true,
data: {
kelime: "merhaba",
temelBilgiler: {
madde: "merhaba",
lisan: "ArapΓ§a",
ozel_mi: false,
cogul_mu: false
},
anlamlar: [
{
sira: 1,
anlam: "Selam vermek, selamlaΕmak",
ornekler: ["Merhaba arkadaΕ!"],
kullanim: "ΓΌnlem"
}
],
ornekler: [...],
atasozleri: [...],
deyimler: [...],
birlesikler: [...],
etimoloji: { /* etymology */ },
telaffuz: "mer-ha-ba",
sesDosyasi: "https://.../merhaba.mp3",
kullanimTuru: ["ΓΌnlem", "isim"],
metadata: {
islemSuresi: "450ms",
veriKaynaklari: 5,
tamVeri: true
}
},
metadata: {
source: "TDK SΓΆzlΓΌk",
version: "1.4.0",
timestamp: "2024-01-15T10:30:00.000Z"
}
}{
success: true,
data: {
metin: "TΓΌrkΓ§e yazΔ±m ΓΆreneΔi",
sonuclar: [
{ kelime: "TΓΌrkΓ§e", dogru: true, oneriler: [] },
{ kelime: "yazΔ±m", dogru: true, oneriler: [] },
{ kelime: "denetimi", dogru: true, oneriler: [] },
{ kelime: "ΓΆreneΔi", dogru: false, oneriler: ["ΓΆrneΔi", "ΓΆrnek", "ΓΆren"] }
],
istatistik: {
toplamKelime: 4,
dogruKelime: 3,
hataliKelime: 1,
dogrulukOrani: "75.00"
}
}
}try {
const result = await tdk.ara('gecersizkelime123');
if (!result.success) {
console.error('Hata:', result.error.message);
console.error('Detay:', result.error.details);
console.error('Kod:', result.error.code);
}
} catch (error) {
console.error('Beklenmeyen hata:', error);
}- Automatic response caching
- Configurable TTL
- Cache statistics
- Manual cache clearing
- Built-in rate limiting
- Customizable limits
- Fair usage protection
const batchResult = await fetch('/api/batch', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
kelimeler: ['merhaba', 'teΕekkΓΌr', 'sevgi', 'aΕk']
})
});# Direct execution
node index.js
# Using npm script
npm start
# With custom port
PORT=8080 node index.jsFROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 3000
CMD ["node", "index.js"]# Basic tests
node test.js
# With server tests
node test.js --server
# Performance tests
node test.js --performanceconst test = require('./test');
await test.runAllTests();
await test.runPerformanceTest();
await test.runServerTest();- Node.js >= 14.0.0
- npm or yarn
git clone https://github.com/hamzadenizyilmaz/Creart-TDK-Dictionary-API.git
cd Creart-TDK-Dictionary-API
npm install
# Create word database
node -e "const tdk = require('./index'); new tdk();"
# Run development server
npm run devnpm run build
npm test
npm publishWe welcome contributions! Here's how:
- Fork the repository
- Create feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open Pull Request
- Follow existing code style
- Add tests for new features
- Update documentation
- Ensure backward compatibility
- Word Database: ~10,000+ Turkish words
- Response Time: < 500ms average
- Cache Hit Rate: > 60% with caching
- API Success Rate: > 98%
- Memory Usage: < 50MB typical
- Not Official: This is not an official TDK API
- Rate Limits: Respect TDK servers, use caching
- Data Accuracy: Data comes directly from TDK
- Updates: Word database updates automatically
- License: MIT - Free for commercial use
- GitHub Issues: Bug Reports & Feature Requests
- Email: info@hamzadenizyilmaz.com
- Website: https://hamzadenizyilmaz.com
- Documentation: Full API Docs
- β Asterisk/Wildcard Search - Advanced pattern matching
- β Spell Checking System - Turkish spell checker
- β Daily Word Feature - Word of the day
- β Proverb Search - Separate proverb/idiom search
- β Similar Words - Semantic similarity
- β Letter Search - Words by starting letter
- β Popular Searches - Most searched words
- β Random Word - Random Turkish word
- β Pronunciation - Audio pronunciation
- β Cache Management - Enhanced caching
- β Rate Limiting - API protection
- β Batch Operations - Multiple word search
- β Health Monitoring - System health check
- β Complete rewrite with class-based architecture
- β Advanced error handling and recovery
- β Retry mechanism with exponential backoff
- β Detailed logging system
- β Multi-language support (English/Turkish)
- β Optional response caching
- β Comprehensive documentation
- β Improved performance with parallel requests
- β Enhanced TypeScript support
- β Better test coverage
- β Added response caching
- β Improved error messages
- β Additional configuration options
- β Enhanced documentation
MIT License - see LICENSE file for details.
- TDK (TΓΌrk Dil Kurumu) - For the dictionary data
- R10 Community - For feature suggestions
- Contributors - Everyone who helped improve this project
{
"name": "creart-tdk",
"version": "1.4.0",
"description": "Creart TDK Dictionary API is an advanced Node.js module that provides easy access to the Turkish Language Association (TDK) dictionary data. It allows developers to retrieve word definitions, synonyms, antonyms, and other linguistic information programmatically.",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/hamzadenizyilmaz/Creart-TDK-Dictionary-API.git"
},
"keywords": [
"tdk",
"turkish",
"dictionary",
"language",
"api",
"turkish-language",
"etymology",
"proverbs",
"sozluk",
"turkce",
"nlp",
"linguistics",
"turkish-dictionary",
"tdk-api",
"turkish-words",
"language-processing",
"turkish-nlp"
],
"author": {
"name": "Hamza Deniz YΔ±lmaz",
"url": "https://hamzadenizyilmaz.com",
"email": "hamzadenizyilmaz@creartcloud.com"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/hamzadenizyilmaz/Creart-TDK-Dictionary-API/issues"
},
"homepage": "https://github.com/hamzadenizyilmaz/Creart-TDK-Dictionary-API#readme",
"dependencies": {
"axios": "^1.6.0",
"express": "^4.18.2",
"cors": "^2.8.5",
"helmet": "^7.0.0",
"express-rate-limit": "^7.1.5",
"node-cache": "^5.1.2"
}
}