How digitalpalidictionary/dpd-db works
Main Components
• Data Ingestion & Processing Modules:
– There are many “deconstructor” modules (both in the archive/ folders and in go_modules/deconstructor) that ingest raw Pāḷi texts, apply sandhi rules, split words, and deconstruct compounds.
– Frequency calculators (go_modules/frequency, db/frequency scripts, and related tools) process and generate statistics.
– Various “families”, “inflections”, “lookup”, and “variants” submodules (under db, exporter, and tools) indicate that the project processes core dictionary data and metadata.
• Data Storage & Database:
– The “db” folder and its subdirectories house source files, helper functions, and a variety of TSV backups.
– Tools for converting, backing up, and rebuilding the database (scripts/backup, tools/[...]) form the persistent storage layer.
• Export & Integration Modules:
– Under “exporter” you see modules for outputting different dictionary formats (GoldenDict, Kindle, Kobo, etc.) and a rich set of templates.
– There is also the “go_modules/dpdDb” which likely holds the models and DB access code.
• API/Service Layer (Web Apps and External Interfaces):
– The “exporter/webapp” directory and the various API integrations in the README (e.g., GoldenDict, DictTango) indicate that there is a REST/web service layer providing dictionary lookup.
– GUIs in folders “gui” and “gui2” are desktop client interfaces (using PySimpleGUI and similar libraries).
• Build, Deployment, and Auxiliary Tools:
– Numerous scripts in “scripts”, “tools”, “misc” and the GitHub workflows (.github/workflows) show continuous integration and build scripts.
– “go_modules” additionally includes test suites and tool components for configuration and database setup.
Relationships and Data Flow
• Raw Data (resources/ other text files) and source TSV/Excel files (e.g., under misc, shared_data, resources) feed into data ingestion modules.
• Processing modules (e.g., the deconstructor in Go and Python, frequency analysis scripts, sandhi splitters) take the raw inputs and produce structured DB files.
• The resulting database (stored in TSV, sometimes rebuilt with scripts or Go modules) is used by various export processes to generate dictionary lookup files for different platforms.
• Exporters and webapp modules (both in “exporter” and “go_modules”) then expose the functionality as APIs or GUIs for end users.
• Finally, integration points with external services (as documented in the readme’s integration section) receive or utilize the exported dictionary data.
Architectural Patterns and Design Principles
• Modular Design and Separation of Concerns:
– Notice how deconstruction, frequency analysis, export, GUI frontends, and tools are kept in self-contained modules.
– This facilitates an MVC-like separation: the “model” (database, TSV files, processed data) is maintained by backend scripts; the “view” (GUIs, webapp, exported formats) is independent; and the “controller” logic is distributed across processing scripts and API/network layers.
• Polyglot Implementation:
• High Extensibility & Integration:
– The presence of multiple exporters, API modules, and integration folders (“integrations” in the docs) shows the system is built to feed external applications.
Relevant Technologies & Frameworks
• That the system uses Git (with GitHub workflows), Go for core processing and frequency analysis, and Python for many utility scripts and GUI development.