Git Product home page Git Product logo

chinese-support-addon's People

Contributors

ajgrf avatar bendotli avatar fsonntag avatar hoeken avatar jkitching avatar ospalh avatar ttempe avatar varbird 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

chinese-support-addon's Issues

Simplified/Traditional fields don't check for spaces

A very minor almost-can't say it's a problem, but:
If you put in characters separated by a space, the simplified field will update, even if they're both simplified. (I haven't tried it with the Traditional field since I don't use it; I assume the same is true for the Traditional field.)

For example, if I put this in for the hanzi:
'你 好'
(with a space)

The simplified field updates with this:
'你好'

Allow multiple transcription in the same card

The kind of transcription desired can now be chosen in the options, and must be the same for every card. It would be interesting, as it was done with the Simplified/Traditional fields, to allow and fill automatically multiple kinds of trascriptions in the same card (for example having a field Pinyin and a field Jyutping, end eventually others, that would be both filled with the appropriate transcription).

Keep hanzi in extra field

Hi,
I just remembered the (a) reason why it is a good idea to keep the hanzi in a separate field:
When you add the ruby brackets and the spans between the characters of a word, it becomes hard to search for that word.

Special characters in the username (Mornir's bug)

On Windows, when you have a nonalphabetic (Chinese, accented...) character in your Windows username, you will encounter the following bug when running Anki.

Traceback (most recent call last):

File "C:\cygwin\home\dae\win\build\pyi.win32\anki\outPYZ1.pyz/aqt.addons", line 38, in loadAddons

File "c:\pyi\iu.py", line 436, in importHook

File "c:\pyi\iu.py", line 521, in doimport

File "C:\Users\Ren�\Documents\Anki\addons\Chinese_support.py", line 59, in

import chinese.edit

File "c:\pyi\iu.py", line 436, in importHook

File "c:\pyi\iu.py", line 521, in doimport

File "C:\Users\Ren�\Documents\Anki\addons\chinese\edit.py", line 25, in

import edit_behavior

File "c:\pyi\iu.py", line 436, in importHook

File "c:\pyi\iu.py", line 521, in doimport

File "C:\Users\Ren�\Documents\Anki\addons\chinese\edit_behavior.py", line 13, in

from edit_functions import *

File "c:\pyi\iu.py", line 436, in importHook

File "c:\pyi\iu.py", line 521, in doimport

File "C:\Users\Ren�\Documents\Anki\addons\chinese\edit_functions.py", line 496, in

characterLookup = characterlookup.CharacterLookup('C')

File "C:\Users\Ren�\Documents\Anki\addons\chinese\cjklib\characterlookup.py", line 110, in init

self.db = dbconnector.getDBConnector(databaseUrl)

File "C:\Users\Ren�\Documents\Anki\addons\chinese\cjklib\dbconnector.py", line 84, in getDBConnector

_dbconnectInst = DatabaseConnector(databaseSettings)

File "C:\Users\Ren�\Documents\Anki\addons\chinese\cjklib\dbconnector.py", line 199, in init

self.connection = self.engine.connect()

File "C:\Users\Ren�\Documents\Anki\addons\chinese\sqlalchemy\engine\base.py", line 1811, in connect

return self.Connection(self, **kwargs)

File "C:\Users\Ren�\Documents\Anki\addons\chinese\sqlalchemy\engine\base.py", line 832, in init

self.__connection = connection or engine.raw_connection()

File "C:\Users\Ren�\Documents\Anki\addons\chinese\sqlalchemy\engine\base.py", line 1874, in raw_connection

return self.pool.unique_connection()

File "C:\Users\Ren�\Documents\Anki\addons\chinese\sqlalchemy\pool.py", line 142, in unique_connection

return _ConnectionFairy(self).checkout()

File "C:\Users\Ren�\Documents\Anki\addons\chinese\sqlalchemy\pool.py", line 369, in init

rec = self._connection_record = pool.get()

File "C:\Users\Ren�\Documents\Anki\addons\chinese\sqlalchemy\pool.py", line 213, in get

return self.do_get()

File "C:\Users\Ren�\Documents\Anki\addons\chinese\sqlalchemy\pool.py", line 600, in do_get

c = self.create_connection()

File "C:\Users\Ren�\Documents\Anki\addons\chinese\sqlalchemy\pool.py", line 147, in create_connection

return _ConnectionRecord(self)

File "C:\Users\Ren�\Documents\Anki\addons\chinese\sqlalchemy\pool.py", line 253, in init

self.connection = self.__connect()

File "C:\Users\Ren�\Documents\Anki\addons\chinese\sqlalchemy\pool.py", line 319, in __connect

connection = self.__pool._creator()

File "C:\Users\Ren�\Documents\Anki\addons\chinese\sqlalchemy\engine\strategies.py", line 82, in connect

return dialect.connect(_cargs, *_cparams)

File "C:\Users\Ren�\Documents\Anki\addons\chinese\sqlalchemy\engine\default.py", line 249, in connect

return self.dbapi.connect(_cargs, *_cparams)

OperationalError: (OperationalError) unable to open database file None None

Hi, just typed 安大略省 into Hanzi bit and it came up with this.

An error occurred in an add-on. Please contact the add-on author.

Traceback (most recent call last):
File "C:\cygwin\home\dae\win\build\pyi.win32\anki\outPYZ1.pyz/aqt.webview", line 18, in run
File "C:\cygwin\home\dae\win\build\pyi.win32\anki\outPYZ1.pyz/aqt.editor", line 492, in bridge
File "C:\cygwin\home\dae\win\build\pyi.win32\anki\outPYZ1.pyz/anki.hooks", line 32, in runFilter
File "C:\Users\Joanna\Documents\Anki\addons\chinese\edit.py", line 40, in on_focus_lost
edit_behavior.update_fields(efields, updated_field, model_name, model_type)
File "C:\Users\Joanna\Documents\Anki\addons\chinese\edit_behavior.py", line 64, in update_fields
t = hide(t, no_tone(t))
File "C:\Users\Joanna\Documents\Anki\addons\chinese\edit_functions.py", line 201, in no_tone
text = no_accents(text)
File "C:\Users\Joanna\Documents\Anki\addons\chinese\edit_functions.py", line 140, in no_accents
return re.sub(r'([a-z])(['+accents+'])([a-z])', desaccentuate_pinyin_sub, text, flags=re.I)
File "C:\cygwin\home\dae\win\build\pyi.win32\anki\outPYZ1.pyz/re", line 151, in sub
File "C:\Users\Joanna\Documents\Anki\addons\chinese\edit_functions.py", line 138, in desaccentuate_pinyin_sub
return ""+p.group(1)+base_letters[p.group(2)]+p.group(3)+get_tone_number(p.group(2))
KeyError: u'\u0100'

I didn't know where to post it, so apologies if this is the wrong place! It just seems to be an issue for that word.

pinyin issue

Hi,
Maybe I'm missing something, but I am only getting one pinyin reading generated when I input a character with multiple readings. For example, I just put in 捧, and the only pinyin generated was fèng (which I assume is an obscure 多音字 reading). I haven't fiddled with the settings at all. Am I doing something wrong?
Thanks so much for writing this addon, it's a lifesaver!

Automatic fill in is not working

Hi!
I've been using Chinese support for a while and it is a great add-on.
Suddenly this week it stopped working. Is this a general problem?
Should I try to install it again?

Error downloading dictionary (1)

When i try to download a dictionary, i get

An error occurred in an add-on. Please contact the add-on author.

Traceback (most recent call last):
  File "/home/roland/anki-alt/addons/chinese/translate.py", line 101, in run
    from cjklib.dictionary.install import DictionaryInstaller
  File "/home/roland/anki-alt/addons/chinese/cjklib/dictionary/install.py", line 65, in 
    from cjklib import build
ImportError: cannot import name build

I don't know about this. The only build.py i could find was in cjklib/test. This may be a problem with cjklib.

The 'Toogle Chinese Support' button doesn't work

I created a duplicate of the 'Cloze' note with an intent to use it for Chinese (the Cloze field has been renamed Hanzi). I filled out all the required fields (Pinyin, Sound, Simplified, etc.) then toogled the hanzi button, but the field doesn't automatically fill in.

https://dl.dropboxusercontent.com/u/23873169/Misc/ChineseCloze%200_7_5.png

After manually changing the Editor Behavior, it works:
https://dl.dropboxusercontent.com/u/23873169/Chinese%20Support/0_7_5/EditorBehavior.png

https://dl.dropboxusercontent.com/u/23873169/Chinese%20Support/0_7_5/PostChangingEditor.png

Note: The Sound and Color fields don't update because I removed the functionality for them in the Editor Behavior file
Also note that if I disable the 'Hanzi' button, the automatic fill-ins don't work, as expected.
Another note: I haven't tested if the button works with non-Cloze type notes.

Interference with other add-ons

The “Quick-and-dirty trick” to fix #7 is too dirty for my taste.

For my add-on i came up with what i think is reasonably clever code to use a site packages when it is installed and to ignore that when it’s not there, basically

try:
    from pydub.silence import detect_nonsilent
    # Look for a reasonable new pydub
except ImportError:
    processor = None
else:
    from .audio_processor import AudioProcessor
    processor = AudioProcessor()

And later just use if processor to either use this code or not.

The problem is that the import will never work, because your add-on removed the directory where the site packages is from the search path.

I guess my branch is not really a solution. That would be back to square one, or issue #7.

Afaik the problem is different versions of several libraries your add-on brings along. (Although i can’t find cjklib any more.)
Maybe it works when you leave the paths alone and use relative imports like from .python-2.7-modules import md5 instead of plain import md5. Note the dot before the pytho-2.7-modules. (I have not tried this. Just a general idea.)

Create a "Pinyin" shared deck

Teach people to recognize Pinyin from TTS data, and to improve their pronounciation with TTS.

Just make a list of characters, all with 1st-tone, that cover most of the Pinyin possible combinations.
Then, create a deck of cards with just "Pinyin" and "Sound" (2 ways), and share it on Ankiweb.

Make it more AnkiWeb/AnkiMobile/AnkiDroid-friendly

And another one why i liked my old code better:
While i have written some add-on that do add new {{NN:...}}-templates, those are something of a bad idea for a general audience:
They work only with the desktop client, not with AnkiWeb or the mobile clients.
I think it is a better idea to just limit yourself to the original templates.
So, maybe this is a reason to add a few fields again:

  • Keep the Hanzi, see issue #1, so you can easily show them without color
  • Maybe a field with the pinyin text without vowel decorations, stored in the card, so you can show those on AnkiWeb &c.
  • Maybe set up the CSS template for different cards so that the color is shown only some of the time. This may require extra classes and complicated CSS selectors, especially when you want color on the answer but not on the question.

Feature request: Multi-word sentences

Using compatibility mode, if I enter a sentence, the translation does not work, and the pinyin is lossy at best.

For example, I enter in the Hanzi field: "我 在 图书馆。"

I expect to see in the Meaning field, the result of google translate: "I'm in the library.". I see nothing.

I expect to see in the pinyin field (as reported by google translate): "Wǒ zài túshū guǎn." I see "tú shū guǎn 。"

In the meantime, I have been entering the meaning and pinyin from these sentences manually from google.

Thank you for the great plugin.

Incorrect Romanization (jyutping) --- a suggestion

This is both a "bug" and a suggestion:

The Cantonese jyutping is often wrong, sometimes for VERY common characters (可 should be "ho2" not "hak1" as the most common example.) I realize you are simply using an existing database, but would it be possible to add an "override transcription" table in the edit behavior file so that we can easily override common bad transcriptions? This would be quite handy vs. having to manually edit them in every card we create.

Incorrect colors on Hanzi based on compound pinyin

Description

When doing bulk "Fill incomplete readings and colors" of an expression like "老师是**人" when the Pinyin field is already filled to "Lǎo shī shì Zhōng guórén." will cause the Pinyin field to be correctly annotated with colors, but the resulting Color field, will have incorrect tone markings.

If I then open the card and click on the Pinyin text field for editing and then click out of it, it automatically changes the Pinyin from "Lǎo shī shì Zhōng guórén." to "Lǎo shī shì Zhōng guó rén." (note exactly the same tone reading, just puts a space between the two syllables of the last word) and fixes the Color field as well.

Possible fix

Apply whatever function automatically cleans up inputted pinyin in the editor to pinyin that is found during the bulk "Fill incomplete readings and colors"

Screen shots

Pre-selecting text box in editor, card view

Pre-selecting text box in editor, editor view

After automatic changes that occurred to pinyin after visiting that field in the editor:

Post-selecting text box in editor, editor view

Post-selecting text box in editor, card view

Create a "Chinese tones" shared deck

Create a deck with sequences of 2 characters, that cover all possible tone combinations with a variety of pinyin sounds.

The cards only need Pinyin and Audio, best would be two-ways and with tone coloring. One needs to check audio for each note, as Microsoft TTS does not always pronounce the tones as one would expect.

Then, share the deck on Ankiweb.

Cannot select Editor Behaviour from menu

Hi,

Whenever I select Editor Behaviour from the menu, I get the following error:


An error occurred in an add-on. Please contact the add-on author.

Traceback (most recent call last):
File "/Users/daveedwards/Documents/Anki/addons/chinese/ui.py", line 80, in edit_logic
edit_window.text.setPlainText(unicode(open(Chinese_support.edit_behavior_filename).read(), "utf8"))
AttributeError: 'module' object has no attribute 'edit_behavior_filename'


I'm using Anki 2.0.3 on Mac OS X 10.6.8. Please let me know if you need any further information.

Error downloading dictionary (2)

Sorry. Still not finished.
It looks like you set the values in chinese/dict_setting.py too soon, before the download has finished.
Which causes more problems when the download didn't work. See #8
When i start after a failed download, i get

Traceback (most recent call last):
  File "/home/roland/work/github/anki-work/ankiqt/aqt/addons.py", line 43, in loadAddons
    __import__(file.replace(".py", ""))
  File "/home/roland/anki-alt/addons/Chinese_support.py", line 79, in 
    chinese.translate.init_dict(chinese.dict_setting.dict_name)
  File "/home/roland/anki-alt/addons/chinese/translate.py", line 65, in init_dict
    cjkdict=cjklib.dictionary.CFDICT()
  File "/home/roland/anki-alt/addons/chinese/cjklib/dictionary/__init__.py", line 701, in __init__
    super(HanDeDict, self).__init__(**options)
  File "/home/roland/anki-alt/addons/chinese/cjklib/dictionary/__init__.py", line 605, in __init__
    super(CEDICT, self).__init__(**options)
  File "/home/roland/anki-alt/addons/chinese/cjklib/dictionary/__init__.py", line 532, in __init__
    super(EDICTStyleEnhancedReadingDictionary, self).__init__(**options)
  File "/home/roland/anki-alt/addons/chinese/cjklib/dictionary/__init__.py", line 271, in __init__
    % self.DICTIONARY_TABLE)
ValueError: Table 'CFDICT' for dictionary does not exist

in addition to the warning from #7

fill incomplete sounds failed

I've used chinese support for a few time without trouble, but this time I tried to add some new cards. Every missing field is ok, but missing sounds failed. I tried to restart, but it's just the same, message error says "retry later" :s

Can you help me please?

Color hanzi not deleted when hanzi is deleted

Before the latest version (0.10, I think?), when adding a new word, emptying the hanzi field would also empty all the other fields. Now, the "Color" field remains filled and has to be emptied by hand, which is inconvenient (and unexpected).

Link to outdated docs.

Hi.
Looks like there is a link to my outdated docs left, at the very top of the project page. (I think that is a bit you have to change on the github page itself, rather than in your repo at home.)

Pinyin with numbers (Editor Behavior)

I want to display pinyin with numbers instead of tone marks. Seems I need to use the no_accents() code but I'm not sure how to use it. Can anyone help me?

Missing Bulk-add reading

If you create card by card, it will work perfectly, but if you import a .txt file with cards formatted using the semicolon division, it won't add the readings. It will add them only in a certain way, which is tedious and cumbersome. If you want to reproduce the "problem" do the following:

  1. create a txt file with 5 cards.
  2. import it, choosing "Chinese" note type and Chinese as deck name.
  3. start to review, they won't have readings.
  4. when on one card, choose Edit and click on Cards... (the window with the css code), don't do anything; now close it.
  5. click the spacebar to reveal the answer of that card. It will now have the proper reading.

The fact is that if you start having 200, 500, 2000 cards it starts to get tedious. Can we get a Bulk-add readings?

Google TTS not working

If I check Baidu Translate for TTS, everything works as expected, i.e. the sound file gets downloaded and properly linked. However, if I check Google Mandarin TTS, no sound file gets generated when I add a card.

This is on Archlinux, Anki Version 2.0.33, Qt 4.8.7, PyQt 4.11.4, Chinese-support-addon 0.10.10.

Minor Transcription Issue

Thank you for fixing the transcriptions. Just noticed that 广 is transcribed as yǎn instead of guǎng. I am using the English dictionary.

If any other one-word transcription issues arise, should I update this issue or create a new one?

Documentation is out of date.

The documentation linked to from the Readme.md file is out of date.

Yes. I know who wrote that documentation.

For example, my page still mentions "Chines" rather then "Chinese word" as the model to use.
It also still speaks about the extra pinyin field.

So, what shall we do? I don't really want to update that myself too much.

Error on 1st startup, on Windows

After downloading the add-on, a message displayed something along the lines of "Download successful, please restart Anki."

Upon restarting Anki 2, this error message displayed:
An error occurred in an add-on. Please contact the add-on author.

Traceback (most recent call last):
File "C:\cygwin\home\dae\win\build\pyi.win32\anki\outPYZ1.pyz/aqt.addons", line 38, in loadAddons
File "c:\pyi\iu.py", line 436, in importHook
File "c:\pyi\iu.py", line 521, in doimport
File "C:\Users\Lincoln\Documents\Anki\addons\Chinese_support.py", line 59, in
import chinese.edit
File "c:\pyi\iu.py", line 436, in importHook
File "c:\pyi\iu.py", line 521, in doimport
File "C:\Users\Lincoln\Documents\Anki\addons\chinese\edit.py", line 25, in
import edit_behavior
File "c:\pyi\iu.py", line 455, in importHook
ImportError: No module named edit_behavior

Statistics don't work for filtered decks

From Iain Dalton:

What I did:
I made a filtered deck using the search note:"Chinese character" (the name of the note type I use for characters I've learned how to write), then went to that deck and clicked on Show statistics.

What happened:
All the regular statistics work, except forecast; but Chinese characters and Chinese Vocabulary show no data, and report "0 known characters/notes."

What I expected:
I expected to see the charts filled out the same as if I had all my characters stored in their own deck and were looking at the statistics. I like to review everything together, but I also like to check how many characters I know how to write, which is less than all the characters I can recognize, so I can't just check the main deck statistics.

Error while creating cards in 0.7.6

After updating to 0.7.6, I get the following error. It occurs after I put some characters in the 'Hanzi' field and wait for the reading to generate. This occurs, and no reading is generated. The error persists even after uninstalling and reinstalling the addon.

Traceback (most recent call last):
File "C:\cygwin\home\dae\win\build\pyi.win32\anki\outPYZ1.pyz/aqt.webview", line 18, in run
File "C:\cygwin\home\dae\win\build\pyi.win32\anki\outPYZ1.pyz/aqt.editor", line 455, in bridge
File "C:\cygwin\home\dae\win\build\pyi.win32\anki\outPYZ1.pyz/anki.hooks", line 32, in runFilter
File "C:\Users\Art\Documents\Anki\addons\chinese\edit.py", line 47, in on_focus_lost
edit_behavior.update_fields(efields, updated_field, model_name, model_type)
NameError: global name 'edit_behavior' is not defined

No module named decimal

It has been mentioned in the thread somewhere, but rather vaguely:
When i tried the newest version on a computer without a full Python, i get a complained
ImportError: No module named decimal
Decimal is part of the Python standard library, and usually it is "Batteries included" when you deal with Python, but dae took out the batteries, so to speak.

color doen't work

Hi, the add-on is great and it work perfectly; the only problem is that the function that colors the pin-yin according to the tones, doesn't work anymore.
is any way to fix this?
thank you in advance

Simplified and traditional characters

Hi,

I am trying to learn both simplified and traditional characters. The old Pinyin toolkit used to automatically fiil up two fields "simplified" and "traditional" and to change any entry to your prefered set if needed. It seems that this is not a feature of chinese-support-addon.

Any plan to add it ?

Thanks for the work

Use json

This one is not an error, but the suggestion of an enhancement.
Instead of writing values into a python file, i would use (simple)json. It's really simple.
You basically say object = json.load(open(json_file_path, 'r')) to get to the values and json.dump(object, open(json_file_path, 'w')) to save them.
An example i used is storing "bad" hash values.
My idea would also be to start without a file and use that to indicate no dictionary selected, like the dict_name='None' you used and use a try: ... json.load(...) to check.

3rd tone sandhi, resolving other issues of colouring and pinyin generation

Hi,

first of all, I'm so glad that someone with the know-how is working on a functional alternative of Pinyin Toolkit. I'm also glad to see some fresh ideas that use the new functionalities of Anki 2.0. That said, I still believe the Chinese Support add-on has a long way to go, especially with regard to the most important feature i.e. pinyin and colour generation:

First of all, (inaccuracies put aside) there's some crucial functions missing from the pinyin and colour generation, notably the 3rd tone sandhi feature known form Pinyin Toolkit. whenever a 3rd tone character preceded another 3rd tone character, the pinyin toolkit would colour it in a light shade of green. I hope you'll consider implementing the feature in your future releases.

Similar option could be introduced for the Characters 不 and 一, which change their tones depending on the next characters. I don't know why, but when I tested the pinyin generation on some phrases, I ended up with 不 in yellow. Sure, it can be pronounced in the second tone (although it's rather unorthodox and somewhat confusing to transcribe it as such in Pinyin) before another character in the 4th tone, but the yellow 不 I got was in the phrase 不打扫, i.e. before a character in the 3rd tone. Curiously, the phrase 打扫 was also rendered as yellow+green, i.e. 2+3rd tone. Not sure if that is intentional to show the pronunciation change of 打 from 3rd to 2nd tone before another 3rd tone character, but it is terribly confusing. If I were new to learning Chinese I might have gotten the impression that 2nd tone is the default pronunciation of 打. On the other hand, 打 is a 多音字, so it might have just been its much much less frequent pronunciation for the meaning of a dozen.

Another, more important issue is that the add-on is not really compatible with the cards generated with the old Pinyin Toolkit. It will time and again try to override the reading field that was generated with the old toolkit but fail resulting in a scrambled pronunciation. This is a serious issue as it can corrupt users' databases.

Warning on (my) Linux box

I hate to rain on your parade, but when i start the 0.4.0 version on my Linux box (Fedora 17, but i guess the point is with a full Python), i get

An error occurred in an add-on. Please contact the add-on author.

/home/roland/anki-alt/addons/chinese/cjklib/util.py:51: UserWarning: Module sqlalchemy was already imported from /home/roland/anki-alt/addons/chinese/sqlalchemy/__init__.pyc, but /usr/lib64/python2.7/site-packages is being added to sys.path
  from pkg_resources import (Requirement, resource_filename,
/home/roland/anki-alt/addons/chinese/cjklib/util.py:51: UserWarning: Module httplib2 was already imported from /home/roland/work/github/anki-work/libanki/thirdparty/httplib2/__init__.pyc, but /usr/lib/python2.7/site-packages is being added to sys.path
  from pkg_resources import (Requirement, resource_filename,

As this is a warning about different versions, i guess you can just ignore this.

Get files from GoogleTTS

And another thing of a more positive note:
You wrote that you think about integrating AwesomTTS . Maybe you want to take a look at my download audio add-on (that i have have not yet published on AnkiWeb but that works all right already) and especially google_tts.py which gets text from Google TTS directly, without using the external mplayer.
I guess you don't really need the the blacklist mechanism and the audio processing is a bit tricky, too. You should be can cut both of those – and then the use of temp files – out without too much problems, but i think my free_media_name() from [exists.py](from https://github.com/ospalh/anki-addons/blob/master/downloadaudio/exists.py) might be useful.

Allow selection of Cantonese romanization

Most learning materials in the US are written with Yale Cantonese romanization, but this extension only supports Jyutping currently. It would help if the romanization could be selected.

There are existing converters out there such as cjklib's JyutpingYaleConverter, but I don't know if you'd want to take a dependency for it.

Character causes plugin to fail

Note: I got these characters from a course on memrise. I suspect that there's something different with these characters which are causing these strange problems. Consequently, I also cannot use the fill in missing fields feature, probably because of this.

A certain character, ⺌, ⺍ (not sure why this one is a box, try putting it in Google Translator and the character will show up. English->Chinese), is causing the plugin to fail for me.

The error happens when I am in the browser and viewing all my cards. I enable the plugin by clicking the button, click the Hanzi field, then click the next field, and this error pops up.

An error occurred in an add-on.
Please post on the add-on forum:
https://anki.tenderapp.com/discussions/add-ons

Traceback (most recent call last):
  File "C:\cygwin\home\dae\win\build\pyi.win32\anki\outPYZ1.pyz/aqt.webview", line 18, in run
  File "C:\cygwin\home\dae\win\build\pyi.win32\anki\outPYZ1.pyz/aqt.editor", line 462, in bridge
  File "C:\cygwin\home\dae\win\build\pyi.win32\anki\outPYZ1.pyz/anki.hooks", line 32, in runFilter
  File "D:\Users\user\Documents\Anki\addons\chinese\edit.py", line 47, in on_focus_lost
    edit_behavior.update_fields(efields, updated_field, model_name, model_type)
  File "D:\Users\user\Documents\Anki\addons\chinese\edit_behavior.py", line 523, in update_fields
    update_all_Transcription_fields(field[updated_field], field)
  File "D:\Users\user\Documents\Anki\addons\chinese\edit_behavior.py", line 271, in update_all_Transcription_fields
    update_Bopomofo_fields(hanzi, dico)
  File "D:\Users\user\Documents\Anki\addons\chinese\edit_behavior.py", line 258, in update_Bopomofo_fields
    t = colorize( transcribe( no_sound( hanzi ), "Bopomofo") )
  File "D:\Users\user\Documents\Anki\addons\chinese\edit_functions.py", line 270, in transcribe
    r = bopomofo_module.bopomofo(no_accents(r))
  File "D:\Users\user\Documents\Anki\addons\chinese\edit_functions.py", line 162, in no_accents
    if len(text)==0:
TypeError: object of type 'NoneType' has no len()

Another character (龵) (yes, the character looks blank for some reason; paste it into Google translate) causes it to fail with a different error:

An error occurred in an add-on.
Please post on the add-on forum:
https://anki.tenderapp.com/discussions/add-ons

Traceback (most recent call last):
  File "C:\cygwin\home\dae\win\build\pyi.win32\anki\outPYZ1.pyz/aqt.webview", line 18, in run
  File "C:\cygwin\home\dae\win\build\pyi.win32\anki\outPYZ1.pyz/aqt.editor", line 462, in bridge
  File "C:\cygwin\home\dae\win\build\pyi.win32\anki\outPYZ1.pyz/anki.hooks", line 32, in runFilter
  File "D:\Users\user\Documents\Anki\addons\chinese\edit.py", line 47, in on_focus_lost
    edit_behavior.update_fields(efields, updated_field, model_name, model_type)
  File "D:\Users\user\Documents\Anki\addons\chinese\edit_behavior.py", line 523, in update_fields
    update_all_Transcription_fields(field[updated_field], field)
  File "D:\Users\user\Documents\Anki\addons\chinese\edit_behavior.py", line 267, in update_all_Transcription_fields
    update_Transcription_fields(hanzi, dico)
  File "D:\Users\user\Documents\Anki\addons\chinese\edit_behavior.py", line 187, in update_Transcription_fields
    t = colorize( transcribe( no_sound( hanzi ) ) )
  File "D:\Users\user\Documents\Anki\addons\chinese\edit_functions.py", line 56, in colorize
    text = re.sub(u'([\u3400-\u9fff])', colorize_hanzi_sub, text)
  File "C:\cygwin\home\dae\win\build\pyi.win32\anki\outPYZ1.pyz/re", line 151, in sub
  File "D:\Users\user\Documents\Anki\addons\chinese\edit_functions.py", line 37, in colorize_hanzi_sub
    return u'<span class="tone{t}">{r}</span>'.format(t=get_tone_number(transcribe(p.group(1), only_one=True)), r=p.group())
  File "D:\Users\user\Documents\Anki\addons\chinese\edit_functions.py", line 636, in get_tone_number
    if re.match(r".+1[0-9]$", pinyin):
  File "C:\cygwin\home\dae\win\build\pyi.win32\anki\outPYZ1.pyz/re", line 137, in match
TypeError: expected string or buffer

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.