Giter VIP home page Giter VIP logo

anki-chinese-vocabulary-generator's Introduction

Anki-Chinese-Vocabulary-Generator

Enter only simplified characters and create word meaning with Traditional, Pinyin, Meaning, Audio and example sentences offline.

Demo

demo

Features

  • Generate word list from imported file
  • Traditional, Pinyin, Meaning and Audio generated automatically
  • Offline fetch meaning from data folder. (cedict)
  • Fetch sentences from data.db offline
  • Fetch meaning using Google translate when not found in cedict
  • Save audio file in using gTTS or DeepHorizons/tts
  • Save list to text file, can be imported to Anki
  • Edit / Delete

Quick start (Windows)

  1. Install Python
    https://www.python.org
  2. Download this repository
    https://github.com/infinyte7/Anki-Chinese-Vocabulary-Generator/archive/master.zip
  3. Install git
    https://git-scm.com/
  4. Install required library in requirements.txt To install
pip install -r requirements.txt

requirements.txt file contains following

jieba
gTTS
pinyin
pycedict
hanziconv
googletrans
git+https://github.com/DeepHorizons/tts

Install latest version googletrans==4.0.0rc1.

  1. Run main.py and start adding words

To run on linux

Download this repository and then follow the steps:

  1. Install python3
    https://www.python.org
  2. Download this repository
    https://github.com/infinyte7/Anki-Chinese-Vocabulary-Generator/archive/master.zip
  3. Install pip3
python3-pip
  1. Install following dependencies
jieba
gTTS
pinyin
pycedict
hanziconv
googletrans==4.0.0rc1

Command to install

python3 -m pip install -r requirements_linux.txt
  1. Run main_for_linux.py
python3 main_for_linux.py

To run on mac

Download this repository and then follow the steps:

  1. Install python3
    https://www.python.org

  2. Download this repository
    https://github.com/infinyte7/Anki-Chinese-Vocabulary-Generator/archive/master.zip

  3. Install following dependencies

jieba
gTTS
pinyin
pycedict
hanziconv
googletrans==4.0.0rc1

Command to install

pip3 install -r requirements_mac.txt
  1. Run main_for_mac.py
python3 main_for_mac.py

Demo

To run on Android using Pydroid 3

  1. Install Pydroid 3 from play store
  2. Download this repository
    https://github.com/infinyte7/Anki-Chinese-Vocabulary-Generator/archive/master.zip
  3. Install following using Pip inside Pydroid 3. It requires Pydroid repository plugin also.
jieba
gTTS
pinyin
pycedict
hanziconv
googletrans==4.0.0rc1
  1. Download this keyboard 搜狗输入法 sōugǒu shūrù fǎ sogou Input from play store
    Note: Other keyboard will not help in typing chinese characters
  2. Open the main_for_android.py inside Pydroid 3
  3. Run the script and start adding words

Image

Demo

Note

Languages & voices for DeepHorizons/tts may be needed to install for windows.

Data

Dictionary

The json_data folder contains dictionary data of CC-CEDICT converted to individual .json file using cedict-json.
CC-CEDICT

Sentences

The data.db contains sentences downloaded from https://tatoeba.org/eng/downloads. For accessing sentences matching the words offline.

Audio

The audio_data folder contains audio taken from https://github.com/hugolpz/audio-cmn.
Those audio taken from http://shtooka.net/download.php

Import in Anki

Use Anki Desktop to import it for Anki-xiehanzi

  1. Copy audio from xiehanzi folder to collection.media folder in Anki
  2. Create a new deck
  3. Import generated xiehanzi.txt file
  4. Select Fields separated by: Tabs
  5. Map the fields to respective fields
  6. Then import

Demo

Changelog

Changelog.md

Contribute

Code optimization will be appreciated.

Todo

  • Stop freezing when translating the sentences

License

Read License.md

anki-chinese-vocabulary-generator's People

Contributors

krmanik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

anki-chinese-vocabulary-generator's Issues

Anki Deck generator for multiple languages : exploring avenues

Hello @infinyte7,

Happy to see you used my audio-cmn repository :)

  1. Shtooka Recorder has become LinguaLibre in 2017. We are back on track to record 100s thousands new audios for 100+ languages. See:
  1. Wikidata and MediaWiki APIs allows to fetch definitions in multiples languages. See screenshot below: the right half is fetched via API call over wiktionaries.

LinguaLibre_SignIt-01

Also, I'am just starting to think about LinguaLibre Anki Decks Maker repository, which would:

  1. Given one language (ex: ITA Italian)
  2. Given one associated .zip file: Q385-ita-Italian.zip.
  3. Extract the list of audio filenames then the list of words recorded
  4. Fetch definition via mediawiki API
  5. Code an Anki Decks Maker which use available words, audios/media, definitions data to create elegant Anki decks.

@LinguaLibre volunteers have knowledge to create the steps 1 to 4.
As for Step 5: Code an Anki Decks Maker, we have no knowledge while I assume you gained relevant knowledge on this field when you created Anki-Chinese-Vocabulary-Generator. So I wonder if you could give us some guidance.

  1. Is there a project or Anki documentation page which would best help LinguaLibre's volunteers to code a Anki Decks Maker ?
  2. What resources helped you the most in your project, and which we could use ?
  3. Any specific pitfall we should be aware of ?
    Any tiny comment may help this project a lot.

PS: I'am also considering creating an empty github repository to host this conversation and not occupy your repository.

Add sentences automatically

It seems like you can only add the sentences manually for each word, can this be done automatically (any sentence will do) ?

Problems when trying to start the program

Thanks for your offer to help on Reddit!

I try to reproduce the error but I got another one... Maybe that would be a better way to start?

Thanks a lot in advance!
problem_gif

Some characters/words with more meaning have single meaning only

The meaning of in cedict is as follows

的 的 [de5] /of/~'s (possessive particle)/(used after an attribute)/(used to form a nominal expression)/(used at the end of a declarative sentence for emphasis)/
的 的 [di1] /see 的士[di1 shi4]/
的 的 [di2] /really and truly/
的 的 [di4] /aim/clear/

But the Anki-Chinese-Vocabulary generator only give following result in meaning.

1

Exceptions generated, could not get output.txt

I've got these exceptions and could not generate any output.txt.

user@user Anki-Chinese-Vocabulary-Generator-master % python3 main_for_mac.py

Audio not found in data folder, fetching online
Audio not found in data folder, fetching online
Audio not found in data folder, fetching online
json not found in data folder, fetching online

Exception in Tkinter callback

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/tkinter/__init__.py", line 1885, in __call__
    return self.func(*args)
  File "/Users/user/Downloads/Anki-Chinese-Vocabulary-Generator-master/main_for_mac.py", line 477, in import_file
    self.insert_meaning(l.strip())
  File "/Users/user/Downloads/Anki-Chinese-Vocabulary-Generator-master/main_for_mac.py", line 518, in insert_meaning
    t = translator.translate(ch_sim, src='zh-cn', dest="en")
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/googletrans/client.py", line 182, in translate
    data = self._translate(text, dest, src, kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/googletrans/client.py", line 78, in _translate
    token = self.token_acquirer.do(text)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/googletrans/gtoken.py", line 194, in do
    self._update()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/googletrans/gtoken.py", line 62, in _update
code = self.RE_TKK.search(r.text).group(1).replace('var ', '')

AttributeError: 'NoneType' object has no attribute 'group'

Thanks a lot for your help!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.