File size: 11,275 Bytes
763f4c1 a688aaa 763f4c1 a688aaa 763f4c1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 |
---
license: cc-by-sa-4.0
task_categories:
- text-retrieval
- text-generation
language:
- de
tags:
- wiktionary
- dictionary
- german
- linguistics
- morphology
- semantics
- normalized
size_categories:
- 100K<n<1M
---
# German Wiktionary - Normalized SQLite Database
A fully normalized, production-ready SQLite database of German Wiktionary with complete linguistic information and optimized query performance.
## π― Key Features
- **β
Zero data loss**: All information from original Wiktionary preserved
- **β‘ Lightning-fast queries**: Comprehensive indexing (< 5ms typical queries)
- **π Full grammatical analysis**: Complete inflection paradigms, word forms, 185 unique grammatical tags
- **π Semantic relations**: Synonyms, antonyms, derived/related terms
- **π Multi-language**: Translations to 100+ languages
- **π± Mobile-ready**: Optimized for Flutter/Dart apps on all platforms
- **π£οΈ Pronunciation**: IPA, audio files, rhymes
- **π Rich examples**: Usage examples with citations
- **π Proper normalization**: Tags/topics/categories deduplicated (3NF)
## π Database Statistics
- **Entries**: 970,801 German words
- **Word senses**: 3.1M+ definitions with glosses
- **Translations**: 1.1M+ translations
- **Word forms**: 6.1M+ inflected forms
- **Pronunciations**: 2.3M+ IPA/audio entries
- **Examples**: 427K+ usage examples
- **Unique tags**: 185 grammatical tags
- **Unique topics**: 58 domain topics
- **Unique categories**: 352 Wiktionary categories
- **File size**: ~3.6 GB (uncompressed), ~1.8 GB (compressed)
## ποΈ Database Schema
### Lookup Tables (Deduplicated)
- **tags**: Grammatical tags (nominative, plural, past, etc.)
- **topics**: Domain topics (biology, law, sports, etc.)
- **categories**: Wiktionary categories
### Core Tables
- **entries**: Main word entries
- **senses**: Word senses/meanings
- **glosses**: Definitions for each sense
- **examples**: Usage examples with citations
### Morphology
- **forms**: All inflected forms (declensions, conjugations)
- **form_tags**: Many-to-many: forms β grammatical tags
- **hyphenations**: Syllable breaks
### Phonology
- **sounds**: IPA pronunciations, audio URLs, rhymes
- **sound_tags**: Pronunciation variants
### Semantics
- **synonyms**: Synonymous words
- **antonyms**: Opposite words
- **derived_terms**: Morphologically derived words
- **related_terms**: Semantically related words
- **synonym_tags/synonym_topics**: Synonym metadata
### Translation
- **translations**: Translations to other languages
- **translation_tags**: Translation grammatical tags
### Metadata
- **entry_tags**: Word-level tags
- **entry_categories**: Wiktionary categories
- **sense_tags/sense_topics/sense_categories**: Sense-level metadata
## π Usage
### Download
```python
from huggingface_hub import hf_hub_download
import sqlite3
import gzip
import shutil
# Download compressed database
db_gz_path = hf_hub_download(
repo_id="cstr/de-wiktionary-sqlite-normalized",
filename="de_wiktionary_normalized.db",
repo_type="dataset"
)
# Decompress if needed
if db_gz_path.endswith('.gz'):
db_path = db_gz_path[:-3]
with gzip.open(db_gz_path, 'rb') as f_in:
with open(db_path, 'wb') as f_out:
shutil.copyfileobj(f_in, f_out)
else:
db_path = db_gz_path
# Connect
conn = sqlite3.connect(db_path)
```
### Python Examples
```python
import sqlite3
conn = sqlite3.connect('de_wiktionary_normalized.db')
cursor = conn.cursor()
# Example 1: Get all inflections with grammatical tags
cursor.execute('''
SELECT f.form_text, GROUP_CONCAT(t.tag, ', ') as tags
FROM entries e
JOIN forms f ON e.id = f.entry_id
LEFT JOIN form_tags ft ON f.id = ft.form_id
LEFT JOIN tags t ON ft.tag_id = t.id
WHERE e.word = ? AND e.lang = 'Deutsch'
GROUP BY f.id
''', ('Haus',))
for form, tags in cursor.fetchall():
print(f"{form}: {tags}")
# Example 2: Get synonyms
cursor.execute('''
SELECT s.synonym_word
FROM entries e
JOIN synonyms s ON e.id = s.entry_id
WHERE e.word = ? AND e.lang = 'Deutsch'
''', ('schnell',))
synonyms = [row[0] for row in cursor.fetchall()]
print(f"Synonyms: {synonyms}")
# Example 3: Get IPA pronunciation
cursor.execute('''
SELECT s.ipa
FROM entries e
JOIN sounds s ON e.id = s.entry_id
WHERE e.word = ? AND s.ipa IS NOT NULL
''', ('Haus',))
print("IPA:", [row[0] for row in cursor.fetchall()])
# Example 4: Get definitions
cursor.execute('''
SELECT g.gloss_text
FROM entries e
JOIN senses se ON e.id = se.entry_id
JOIN glosses g ON se.id = g.sense_id
WHERE e.word = ? AND e.lang = 'Deutsch'
''', ('Liebe',))
print("Definitions:")
for (gloss,) in cursor.fetchall():
print(f" - {gloss}")
# Example 5: Get English translations
cursor.execute('''
SELECT t.word
FROM entries e
JOIN translations t ON e.id = t.entry_id
WHERE e.word = ? AND t.lang_code = 'en'
''', ('Hund',))
print("English:", [row[0] for row in cursor.fetchall()])
# Example 6: Find words by topic
cursor.execute('''
SELECT DISTINCT e.word
FROM entries e
JOIN senses s ON e.id = s.entry_id
JOIN sense_topics st ON s.id = st.sense_id
JOIN topics t ON st.topic_id = t.id
WHERE t.topic = 'biology'
LIMIT 20
''')
print("Biology terms:", [row[0] for row in cursor.fetchall()])
# Example 7: Autocomplete search
cursor.execute('''
SELECT DISTINCT word
FROM entries
WHERE word LIKE ? AND lang = 'Deutsch'
ORDER BY word
LIMIT 10
''', ('Sch%',))
print("Words starting with 'Sch':", [row[0] for row in cursor.fetchall()])
conn.close()
```
### Flutter/Dart
```dart
import 'package:sqflite/sqflite.dart';
import 'package:http/http.dart' as http;
import 'package:path/path.dart';
import 'package:path_provider/path_provider.dart';
import 'dart:io';
import 'package:archive/archive_io.dart';
class WiktionaryDB {
static Database? _database;
Future<Database> get database async {
if (_database != null) return _database!;
_database = await initDB();
return _database!;
}
Future<Database> initDB() async {
final dir = await getApplicationDocumentsDirectory();
final dbPath = join(dir.path, 'de_wiktionary.db');
// Download and decompress on first run
if (!await File(dbPath).exists()) {
final url = 'https://huggingface.co/datasets/cstr/de-wiktionary-sqlite-normalized/resolve/main/de_wiktionary_normalized.db';
print('Downloading database...');
final response = await http.get(Uri.parse(url));
final gzPath = join(dir.path, 'de_wiktionary.db.gz');
await File(gzPath).writeAsBytes(response.bodyBytes);
print('Decompressing...');
final gzFile = File(gzPath);
final dbFile = File(dbPath);
// Decompress gzip
final bytes = gzFile.readAsBytesSync();
final archive = GZipDecoder().decodeBytes(bytes);
await dbFile.writeAsBytes(archive);
// Clean up
await gzFile.delete();
print('Database ready!');
}
return await openDatabase(dbPath, version: 1);
}
// Get word forms with grammatical tags
Future<List<Map<String, dynamic>>> getWordForms(String word) async {
final db = await database;
return await db.rawQuery('''
SELECT f.form_text, GROUP_CONCAT(t.tag, ', ') as tags
FROM entries e
JOIN forms f ON e.id = f.entry_id
LEFT JOIN form_tags ft ON f.id = ft.form_id
LEFT JOIN tags t ON ft.tag_id = t.id
WHERE e.word = ? AND e.lang = 'Deutsch'
GROUP BY f.id
''', [word]);
}
// Get synonyms
Future<List<String>> getSynonyms(String word) async {
final db = await database;
final results = await db.rawQuery('''
SELECT s.synonym_word
FROM entries e
JOIN synonyms s ON e.id = s.entry_id
WHERE e.word = ? AND e.lang = 'Deutsch'
''', [word]);
return results.map((r) => r['synonym_word'] as String).toList();
}
// Get IPA pronunciation
Future<List<String>> getIPA(String word) async {
final db = await database;
final results = await db.rawQuery('''
SELECT s.ipa
FROM entries e
JOIN sounds s ON e.id = s.entry_id
WHERE e.word = ? AND s.ipa IS NOT NULL
''', [word]);
return results.map((r) => r['ipa'] as String).toList();
}
// Get definitions
Future<List<String>> getDefinitions(String word) async {
final db = await database;
final results = await db.rawQuery('''
SELECT g.gloss_text
FROM entries e
JOIN senses se ON e.id = se.entry_id
JOIN glosses g ON se.id = g.sense_id
WHERE e.word = ? AND e.lang = 'Deutsch'
''', [word]);
return results.map((r) => r['gloss_text'] as String).toList();
}
// Autocomplete search
Future<List<String>> searchWords(String prefix) async {
final db = await database;
final results = await db.rawQuery('''
SELECT DISTINCT word
FROM entries
WHERE word LIKE ? AND lang = 'Deutsch'
ORDER BY word
LIMIT 20
''', ['$prefix%']);
return results.map((r) => r['word'] as String).toList();
}
}
```
## π Example Queries
### Get complete grammatical analysis
```sql
SELECT
e.word,
f.form_text,
GROUP_CONCAT(DISTINCT t.tag) as grammatical_tags,
s.ipa
FROM entries e
JOIN forms f ON e.id = f.entry_id
LEFT JOIN form_tags ft ON f.id = ft.form_id
LEFT JOIN tags t ON ft.tag_id = t.id
LEFT JOIN sounds s ON e.id = s.entry_id
WHERE e.word = 'lieben'
GROUP BY f.id;
```
### Find words by grammatical features
```sql
SELECT DISTINCT e.word
FROM entries e
JOIN forms f ON e.id = f.entry_id
JOIN form_tags ft ON f.id = ft.form_id
JOIN tags t ON ft.tag_id = t.id
WHERE t.tag = 'irregular' AND e.pos = 'verb'
LIMIT 100;
```
### Get words with semantic relationships
```sql
SELECT
e.word,
s.synonym_word,
a.antonym_word
FROM entries e
LEFT JOIN synonyms s ON e.id = s.entry_id
LEFT JOIN antonyms a ON e.id = a.entry_id
WHERE e.word = 'gut';
```
## π± Platform Support
- **iOS**: β
Full support via sqflite
- **Android**: β
Full support via sqflite
- **Windows**: β
Via sqflite_common_ffi
- **macOS**: β
Via sqflite_common_ffi
- **Linux**: β
Via sqflite_common_ffi
- **Web**: β οΈ Via sql.js (WASM)
## π Performance
Typical query times (modern hardware):
- Word lookup: < 1ms
- Get all forms: < 5ms
- Complex multi-table joins: < 20ms
- Autocomplete search: < 10ms
## π Source
Original data: [cstr/de-wiktionary-extracted](https://huggingface.co/datasets/cstr/de-wiktionary-extracted)
## π License
CC-BY-SA 4.0 (same as source)
## π οΈ Technical Details
- **SQLite Version**: 3.x compatible
- **Encoding**: UTF-8
- **Foreign Keys**: Enabled
- **Indexes**: 38 indexes for optimal performance
- **Normalization**: 3NF with deduplicated tags/topics/categories
## π Schema Overview
```
entries (970K rows)
βββ senses (3.1M) β glosses (3.1M)
βββ forms (6.1M) β form_tags (26M) β tags (185)
βββ sounds (2.3M) β sound_tags
βββ translations (1.1M) β translation_tags
βββ synonyms (162K) β synonym_tags
βββ antonyms
βββ hyphenations (954K)
```
## π€ Contributing
Found an issue? Please report it on the source dataset repository.
|