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