https://github.com/jaxonma/lantradictionary
A Chinese dictionary website built with flask
https://github.com/jaxonma/lantradictionary
flask flask-app flask-application flask-website html-css-javascript python
Last synced: 2 months ago
JSON representation
A Chinese dictionary website built with flask
- Host: GitHub
- URL: https://github.com/jaxonma/lantradictionary
- Owner: JaxonMa
- Created: 2022-07-30T05:55:26.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2026-04-14T16:30:54.000Z (3 months ago)
- Last Synced: 2026-04-14T17:26:22.328Z (3 months ago)
- Topics: flask, flask-app, flask-application, flask-website, html-css-javascript, python
- Language: JavaScript
- Homepage: https://dictionary.lantra.top
- Size: 96.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Lantra Dictionary
Lantra Dictionary is a Flask-based Chinese dictionary web app.
It supports searching both single Chinese characters and multi-character words, and returns pronunciation, radicals, explanations, and related words.
## Requirements
- Python 3.12
- MongoDB (local or remote)
Install dependencies:
```bash
pip install -r requirements.txt
```
## Quick Start
1. Download raw dictionary files from the source listed in [Data Source](#data-source)
2. Put those files into the paths defined in `process_data.py` (`DICTIONARY_PATH`).
3. Process raw data:
```bash
python process_data.py
```
4. Edit MongoDB URI in `setupdb.py`, then import processed data:
```bash
python setupdb.py
```
5. (Optional) edit MongoDB URI in `app.py` if needed.
6. Start the web app:
```bash
python app.py
```
Then open `http://127.0.0.1:5000`.
## Main Files and Folders
- `app.py` - Flask entry point; defines page routes and the `/lookup/` API.
- `dictionary.py` - Query module; fetches single-character or word results from MongoDB.
- `process_data.py` - Converts raw dictionary JSON data into processed files used for DB import.
- `setupdb.py` - Loads processed JSON files and inserts them into MongoDB collections.
- `dictionary/chinese/` - Raw Chinese dictionary data files (not fully included in this repo).
- `processed/chinese/` - Processed output files generated by `process_data.py`.
## Data Source
- [chinese-dictionary](https://github.com/mapull/chinese-dictionary)
> **Required files:** After downloading the data from the source above, ensure you copy the following files into `dictionary/chinese` of your repo for processing:
> - `character/char_base.json`
> - `character/char-detail.json`
> - `character/related.json`
> - `word/word.json`
>
> These files are expected for correct operation of the data processing and import scripts.
## TODO
- Add English dictionary support.