fonol / anki-search-inside-add-card

An add-on providing full-text-search and PDF reading functionality to Anki's Add card dialog
https://ankiweb.net/shared/info/1781298089
GNU Affero General Public License v3.0
178 stars 24 forks source link

Text selection in cloze generation not working as expected #163

Closed ghost closed 3 years ago

ghost commented 3 years ago

Suppose I want to generate a close from the following page

image

I got

A b ottom-up parse corresp onds to the construction of a parse tree for an input string b eginning at the lea v es (the b ottom) and w orking up to w ards the ro ot (the`

instead. Is there any way to fix this? I'm already using the alternative renderer.

fonol commented 3 years ago

Hi, unfortunately, that is how text comes out of pdf.js for some PDFs, and there is not much I can do about it. Internally, the characters in the PDF are just absolute positioned glyphs, and pdf.js tries to correctly assign/segment them into words. That works ok for most PDFs, but for some, the results are not that great. https://github.com/mozilla/pdf.js/issues/12509 https://github.com/mozilla/pdf.js/issues/9998 https://github.com/mozilla/pdf.js/issues/6705

ghost commented 3 years ago

Thanks for your efforts anyway! Your project really helped me a ton:P