Reposition Function for an Add-on

I am writing an add-on and want it to have the ability to reposition new cards. The basic functionality is that it has a list of words, finds new cards corresponding to those words, and places them in a temporary deck. The words are coming from specific written texts in another language and have corresponding numbers for frequency and order of appearance. I’d like the cards to appear in the order of appearance. I’ve looked through the API and haven’t been able to figure out how the repositioning works. I’m looking for like something like the following pseudo-code:

for Word in WordDict:
    notes = findCards(Word)
    for card in notes:
        card.due = Word["appearance-order"]

I know this isn’t exactly how it works in Anki, but it should be enough to know what I mean. I am able to find the cards, it is the card.due part that I need.

Have you tried MorphMan?

Thanks for the suggestion! MorphMan has a similar use case, but the one I’m trying to build is specifically for Biblical Greek and Hebrew to study the vocab for specific books or chapters of the Bible. It looks like the purpose of MorphMan is more general language learning, while my purpose is to learn the vocabulary for large portions of defined textual units. These are also highly inflected languages, which MorphMan seems to have some complaints about because it would treat every inflected form as a different word (see this discussion for example). It looks like there’s a lot of support for Japanese to make it not this way, but this has to be done for every language. However, I may be able to look through the MorphMan code to see a good example of how to use reposition in my code.

I’ve seen a post about that long before I learned that MorphMan was not just for Japanese. The Bible may be small and structured enough to make implementation seem more straightforward, but to MorphMan, a deck of cards is the same as a list of verses. There is Readability Analyzer that generates frequency.txt from a directory of texts, so you can add whatever texts you want, in the order you want (possibly concatenated or telling MorphMan to ignore order), and regenerate the frequency list. There is also a master frequency list, so you can make some immutable text corpus affect the order without being present in the directory being analyzed, where you put other texts.

As the last message says, it’s pretty easy to write your own morphemizer.
It’s not clear from the issue tracker which versions of Anki MorphMan still works on though. I am switching from 2.1.22 and need to adapt my changes to a newer one.