mortii / anki-morphs

A MorphMan fork rebuilt from the ground up with a focus on simplicity, performance, and a codebase with minimal technical debt.
https://mortii.github.io/anki-morphs/
Mozilla Public License 2.0
47 stars 6 forks source link

Make an API for highlighted text #200

Closed Pedrubik2000 closed 3 months ago

Pedrubik2000 commented 3 months ago

I'm attempting to replicate the functionality of this GitHub repository using Anki. To do this, I created an API using your Anki addon. The API receives a sentence as input and returns the highlighted text, indicating known and unknown words or phrases. However, I've encountered an issue where the recalculation process occasionally gets stuck.

I would greatly appreciate it if you could create a stable API for this purpose.

This is an example of the api request: image

And this is an example of how I could be implemented in an extension

https://github.com/mortii/anki-morphs/assets/119679067/911ae208-92df-447f-91e0-3967337d0916

Pedrubik2000 commented 3 months ago

image Another example of how usefult it is.

mortii commented 3 months ago

Oh wow, that's super interesting!

However, I can't really help with this unless you provide steps to reproduce the recalc problem you describe. Have you narrowed down any problematic input?

Pedrubik2000 commented 3 months ago

Oh wow, that's super interesting!

However, I can't really help with this unless you provide steps to reproduce the recalc problem you describe. Have you narrowed down any problematic input?

Sorry, I cant reproduce the problem again.

Pedrubik2000 commented 3 months ago

image I wasnt using the am_db.con.close(). [I still dont known what it does.] Now that I'm using it. It is helping me with a bug that was making sentence dont parse after a while.

Before:

https://github.com/mortii/anki-morphs/assets/119679067/34a94c92-258f-476d-9c16-4a5ebc1462d2

After: image

Edit: I still have the same bug 😢 There is a bug inside the code I wrote.

Vilhelm-Ian commented 3 months ago

a feature I think would be useful for the api is "mark_as_know" for a single morph. I could imagine using something like this and cilcking on words i already know so I doon't have to see them in anki.

I am aware that this is possibly impossibl since we rebuild the database every single time.

A anki api aaddoon exists https://foosoft.net/projects/anki-connect/ . I wounder can we just extend it.

Pedrubik2000 commented 3 months ago

a feature I think would be useful for the api is "mark_as_know" for a single morph. I could imagine using something like this and cilcking on words i already know so I doon't have to see them in anki.

I am aware that this is possibly impossibl since we rebuild the database every single time.

A anki api aaddoon exists https://foosoft.net/projects/anki-connect/ . I wounder can we just extend it.

Perhaps create an extension that parses text with AnkiMorphs and enables adding words to the AnkiMorphs database by pressing ctrl + click on a word. Or utilize Anki-Connect to generate a card with the 'am-known-manually' tag when the shortcut is triggered.

Vilhelm-Ian commented 3 months ago

The second one is a smart workaround. For the first one I think it's not doable. Since the last time I checked how it worked. Every time you press recalc the database is dropped and rebuild from the cards you already know.

mortii commented 3 months ago

I'm pretty blown away by this, it's really, really cool. I'm more than happy to help/answer any questions you might have, but it would be better to do that in a discussion thread rather than an issue like this, so please create one if you want :)

github-actions[bot] commented 3 months ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.