diff -r 206fd730aec4 -r 4c70daa48492 py/gadict_srs_anki.py --- a/py/gadict_srs_anki.py Thu Jan 12 19:03:14 2017 +0200 +++ b/py/gadict_srs_anki.py Thu Jan 12 19:04:32 2017 +0200 @@ -328,24 +328,28 @@ collection.models.save(model) self.model_pl = model - def guid(self, nodetype, headword): + def guid(self, nodetype, headword, unambiguous): + """ + :nodetype used to generate different notes from same headword + :unambiguous used if several subsequent article with same headword (and different pronunciation) """ - :nodetype used to generate different notes from same headword - """ - h = hashlib.md5(":".join((self.name, nodetype, headword))) + if unambiguous > 0: + h = hashlib.md5(":".join((self.name, nodetype, headword, str(unambiguous)))) + else: + h = hashlib.md5(":".join((self.name, nodetype, headword))) return h.hexdigest() - def add_note(self, headword, front, back, safeback, freq, tags=None): + def add_note(self, headword, unambiguous, front, back, safeback, freq="", tags=None): note = anki.notes.Note(self.collection, self.model) note['Front'] = front note['Back'] = back note['SafeBack'] = safeback note['Freq'] = freq note_add_tags(note, tags) - note.guid = self.guid("front/back", headword) + note.guid = self.guid("front/back", headword, unambiguous) self.collection.addNote(note) - def add_note_irr(self, headword, v1, v2, v2alt, v3, v3alt, front, back, freq, tags=None): + def add_note_irr(self, headword, unambiguous, v1, v2, v2alt, v3, v3alt, front, back, freq, tags=None): note = anki.notes.Note(self.collection, self.model_irr) note['V1'] = v1 note['V2'] = v2 @@ -356,10 +360,10 @@ note['Back'] = back note['Freq'] = freq note_add_tags(note, tags) - note.guid = self.guid("irregular verb", headword) + note.guid = self.guid("irregular verb", headword, unambiguous) self.collection.addNote(note) - def add_note_pl(self, headword, singular, plural, front, back, freq, tags=None): + def add_note_pl(self, headword, unambiguous, singular, plural, front, back, freq, tags=None): note = anki.notes.Note(self.collection, self.model_pl) note['Singular'] = singular note['Plural'] = plural @@ -367,7 +371,7 @@ note['Back'] = back note['Freq'] = freq note_add_tags(note, tags) - note.guid = self.guid("singular/plural noun", headword) + note.guid = self.guid("singular/plural noun", headword, unambiguous) self.collection.addNote(note) def export(self, fname): @@ -451,10 +455,12 @@ for identity in FDEL or []: identity = identity.strip() warnmsg = "