batterseapower / pinyin-toolkit

A plugin for the Anki Spaced Repetition System (http://ichi2.net/anki/)
http://batterseapower.github.com/pinyin-toolkit/
39 stars 14 forks source link

Tone Sandhi Generation Error (Also breaks Mass-Fill) #80

Closed Nick3C closed 15 years ago

Nick3C commented 15 years ago

Traceback (most recent call last): File "C:\Documents and Settings\Nick\Application Data.anki\plugins\pinyin\anki\hooks.py", line 123, in self.mw.connect(self.action, QtCore.SIGNAL('triggered()'), lambda: self.triggered()) File "C:\Documents and Settings\Nick\Application Data.anki\plugins\pinyin\anki\hooks.py", line 175, in triggered self.updater.updatefact(factproxy, factproxy["expression"]) File "C:\Documents and Settings\Nick\Application Data.anki\plugins\pinyin\updater.py", line 149, in updatefact dictreading = transformations.tonesandhi(self.config.dictionary.reading(expression)) File "C:\Documents and Settings\Nick\Application Data.anki\plugins\pinyin\transformations.py", line 63, in tonesandhi assert tonecontourqueue.pop() == "~" AssertionError

Nick3C commented 15 years ago

I think I have found the cause of this.... try adding: 妮妮你你你你你 (yes, it's nonsense, but I was testing tone sandhi rules)

File "ankiqt\ui\facteditor.pyc", line 397, in File "ankiqt\ui\facteditor.pyc", line 489, in onFocusLost File "anki\facts.pyc", line 125, in focusLost File "anki\hooks.pyc", line 26, in runHook File "C:\Documents and Settings\Nick\Application Data.anki\plugins\pinyin\anki\hooks.py", line 38, in onFocusLost pinyin.utils.suppressexceptions(lambda: self.updater.updatefact(factproxy, field.value)) File "C:\Documents and Settings\Nick\Application Data.anki\plugins\pinyin\utils.py", line 34, in suppressexceptions action() File "C:\Documents and Settings\Nick\Application Data.anki\plugins\pinyin\anki\hooks.py", line 38, in pinyin.utils.suppressexceptions(lambda: self.updater.updatefact(factproxy, field.value)) File "C:\Documents and Settings\Nick\Application Data.anki\plugins\pinyin\updater.py", line 149, in updatefact dictreading = transformations.tonesandhi(self.config.dictionary.reading(expression)) File "C:\Documents and Settings\Nick\Application Data.anki\plugins\pinyin\transformations.py", line 63, in tonesandhi assert tonecontourqueue.pop() == "~" IndexError: pop from empty list

Seems to be a problem with 3 or more third tones together (which clearly exist in some phrases in my deck)

Nick3C commented 15 years ago

see further commentary at Anki Forum thread here: http://groups.google.com/group/ankisrs/browse_thread/thread/b9696e0f7cc4c209#

Nick3C commented 15 years ago

Realworld example: 泳有小姐 of the phrase 如果游泳有小姐陪。那如果裸体我就去就餐。

also: 酒水饮料

batterseapower commented 15 years ago

Proper fix for the tone sandhi issue, Closed by d368314321fb18a26b3cff4cdd12941d2109ad09