Skip to content

superyed/chinese-support-redux

 
 

Repository files navigation

Chinese Support Redux

Build Status Coverage Status

Chinese Support Redux is a rewrite and port of the Chinese Support add-on to Anki 2.1. It offers a number of features that streamline the process of creating flashcards for learning Chinese. The current focus of development effort is on improving the stability of the add-on and the accuracy of its output. Once the core functionality is sufficiently robust and reliable, additional features will be considered. While many of the changes will be structural in nature, I would encourage users to update the add-on whenever the version number increases and notify me of any problems. Your feedback is important.

The original (and 2.1-incompatible) version is available here.

Note: The add-on has undergone a major rewrite during January to make it more maintainable going forward. This should address many of the issues that were raised last year, but is likely to have introduced different issues I am not aware of. The best way to have these fixed is to raise them on GitHub.

Additional Note: Anyone who wishes to add content to the wiki is more than welcome to.

Features

  • Automatic field filling
    • Translation (from built-in dictionary; supports English, German and French)
    • Romanisation (supports Pīnyīn (拼音) and Cantonese Jyutping (粵拼))
    • Mandarin Audio (fetched from Google or Baidu)
    • Traditional (繁體字) and simplified (簡體字) characters
    • Bopomofo (ㄅㄆㄇㄈ), also known as Zhuyin (注音)
    • Rubies (small-print transcription placed above characters)
  • Tone colours (applied to characters, romanisation and Bopomofo)
  • Built-in note types (Basic and Advanced)

Status

The vast majority of features have been successfully ported, and the add-on is in a usable state, albeit with some definite rough edges.

The add-on is still in beta. By this I mean “it works, but I wouldn’t trust it with my children”. Expect occasional issues, and please make a back-up before trying it. I use it myself and haven't experienced data loss, but your mileage may vary.

Please report any issues here on GitHub. Feature requests are also welcome.

If you are new to the Chinese Support add-on, the wiki from the previous version is still relevant (here).

Usage

The core feature of the add-on is the automatic field filling. To take advantage of this, you need to have an Anki note type with the appropriate fields (e.g., Hanzi, Meaning, Reading, Sound). See config.json for a list of valid field names.

If you don't already have such a note type, the easiest approach is to use one of the built-in models. Two types are installed automatically: Basic and Advanced. The only important difference is that the Advanced model shows more information.

To use the field-filling features:

  1. Add a new note to Anki (press a)
  2. Select Chinese (Basic) or Chinese (Advanced) as the note type
  3. Enable Chinese Support Redux for this note type (click 汉字)
  4. Enter a word (e.g., 電話) into the Hanzi field (sentences will also work)
  5. Press Tab
  6. The remaining fields should then be populated automatically

Screenshots

Screenshot #1

Screenshot #2

Testing

For those who wish to run the tests locally, this is fairly straightforward.

Clone the repository:

git clone https://github.com/luoliyan/chinese-support-redux
cd chinese-support-redux

Ideally, set up a virtual environment to isolate the project:

curl https://pyenv.run | bash
pyenv virtualenv 3.6.8 csr
pyenv local csr

Install dependencies and run the tests:

pip install -r requirements.txt
make test

History

  • 2019.04.02
    • Update bundled libs
      • Fixes gTTS error (hat tip: Robert Irelan)
    • Fix bulk classifier filling
  • 2019.01.17
    • Use jieba library for segmentation
      • Should fix most issues with inaccurate Pinyin
    • Fix Bopomofo generation (courtesy of Matthias Wimmer)
    • Fix errors caused by rare characters (courtesy of Robert Irelan)
    • Fix several broken function calls
    • Fix handling of mixed Chinese/English
    • Major refacting and test expansion
  • 2019.01.01
    • Fix bulk Pinyin filling
    • Refactor several near-duplicate functions
    • Expand tests
  • 2018.12.25
    • Fix accentuate call errors
    • Fix handling of punctuation by colorize functions
    • Try to identify sentences vs. vocab and handle appropriately
    • Respect word separation in Hanzi field
    • Add Chinese→English punctuation mapping
    • Don't apply tone number to punctuation
    • Save configuration on exit
    • Expand tests
    • Tweak regular expressions
    • Tweak searchable HTML formatting
  • 2018.11.30
    • Update gTTS-token (fixes TTS error)
  • 2018.11.15
    • Expand tests
    • Fix and refactor definition filling code
    • Fix incorrect fill counts
  • 2018.11.14
    • Remove bogus tone number from TTS input
    • Simplify inclusion of required libs
  • 2018.11.13
    • Fix incorrect model names
    • Expand and refactor tests
  • 2018.11.09
    • Fix field filling for alternative forms
    • Fix bulk field filling
    • Fix and relocate menu
    • Add models automatically on start-up
    • Refactor tests
    • Tweak configuration
  • 2018.10.26
    • Fix Pinyin and Bopomofo coloring
    • Fix classifier rubies (show one ruby per classifier)
    • Handle non-hanzi in Hanzi field slightly more gracefully
    • Only attempt to add DB indices on first run
  • 2018.10.25
    • Major refactoring and test expansion
      • Functions under test should be more reliable
      • Functions not under test are still black magic
    • Fix several issues with Bopomofo handling
    • Fix filling of classifier field
    • Make splitting of Pinyin optional (internally)
  • 2018.10.12
    • Improve handling of Pinyin (will no longer split)
    • Refactor start-up code
    • Expand and refactor tests
  • 2018.10.11
    • Bundle Google TTS dependencies
    • Improve character selection (courtesy of infernalis)
  • 2018.10.10
    • Refactor TTS code
    • Remove Cantonese TTS (discontinued by Google)
  • 2018.10.09
    • Restore Google TTS (again)
    • Begin seriously starting to wrap tests around this old, buggy code
  • 2018.02.17
    • Fix Fill Incomplete Notes functionality
  • 2017.11.14
    • Fix more issues with automatic field population
    • Move field names into configuration file
  • 2017.11.10
    • Use Anki 2.1 built-in config facilities
  • 2017.11.07
    • Fix issues with automatic field population
  • 2017.11.06
    • Restore Google TTS (for Mandarin and Cantonese)
  • 2017.11.05
    • Initial port to Anki 2.1 (most features working)
    • Restore tone colours in editor

About

Anki add-on providing support for Chinese study

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 57.6%
  • OpenEdge ABL 42.4%