Apkg import support

Cameroon

探花
Is this feature expected to appear in Pleco any time soon?
I've seen a notice on some of chinese forums from Mike dated 2020 that this feature is on the list! Sounds great, hope we'll see it soon

I sync flashcards Desktop<->Android via Anki, since there's no other ways known to me.
But on Android, I like to use Pleco's built-in flashcards system more, so in Pleco I add new words into this built-in system.
Desktop's adding flashcards routine is rather useable, the only thing missing for Android platform is Pleco's ability to import Anki's .apkg (Ankidroid exports only to this format)
 

Cameroon

探花
Great news! Thanks, Mike :)
Will apkg support be bidirectional, or import-only?
(Found that Andidroid can only import own format decks, unlike desktop Anki, so no interchange on lone Android is possible unless Pleco comes to the rescue in both import and export)
 

mikelove

皇帝
Staff member
Import-only at first.

In theory, we could add APKG export support, but our system supports a lot of features Anki doesn't, so to get that working well we'd have to a) add some sort of an "Anki export compatibility mode" to disable a lot of those features, b) add Anki implementations of features people would not want to do without (tone coloring, e.g.), and c) figure out a way to store Anki settings with perfect fidelity so that if people wanted to round-trip import them into and then back out of Pleco their templates etc would not degrade along the way. And with desktop Pleco (at least on Mac and, if successful, on Windows too) on the way, I don't know if there'd be enough interest in Anki export support to justify all of that effort.
 

Cameroon

探花
Import-only at first.

In theory, we could add APKG export support, but our system supports a lot of features Anki doesn't, so to get that working well we'd have to a) add some sort of an "Anki export compatibility mode" to disable a lot of those features, b) add Anki implementations of features people would not want to do without (tone coloring, e.g.), and c) figure out a way to store Anki settings with perfect fidelity so that if people wanted to round-trip import them into and then back out of Pleco their templates etc would not degrade along the way. And with desktop Pleco (at least on Mac and, if successful, on Windows too) on the way, I don't know if there'd be enough interest in Anki export support to justify all of that effort.

How do you always lay everything out in such a perfect logical order, I wonder? Seriously?

Yeah, while basically Pleco's and Anki's flashcards have the same (or similar) structure, upper level customizations (as per abovementioned colorings etc) are quite non-unified for Pleco and Anki, it would be a pain to streamline them both into one.
That's why I think the import feature (and export, should it be added) has to be very basic. Root Hanzi, Simplified (Traditional)/Alternative (if available) variants, Pinyin(s), Bopomofo(s), Definition(s), Example(s). No colorings, sounds, rubies, stroke order diagrams etc.
That is, exactly the set of options provided in Pleco for Anki card addition (if Anki is set as the default flashcard system).

I finally came to this basics in my self-constructed Pleco<->Anki exchange scheme. I exchange only text, words lists, without even definitions.

First I add new words to Pleco's flashcards as I'm used to, and let Pleco do its magic (upper level customizations).
Then I add this same word to Anki via Android's system menu on long tap. Just word. After sync to Anki Desktop, now it's Chinese support Redux plugin's turn to do its magic (+ a couple of other addons). The result being somewhat comparable to Pleco's.
And that happened to be a very comfortable system for me with the only exception that then, a desktop PC is nevertheless needed to export to .tsv and then import to Pleco to keep both worlds in sync. The .apkg import support will take away this pain and thus finalize the scheme ))
This way, Ankidroid serves just as a means of sync (as I said above, I prefer Pleco's flashcards system).

Main drawback is no progress/statistics sync ((
So I'm really excited with the news on future Pleco desktop version!

And, while we all wait for this great day to come, let me propose you some, no, not feature request actually, but suggestion to arrange already implemented features into some different composition:
1. Not to divide 2 flashcard systems (Pleco and Anki) in settings, but allow them both at the same time. Keeping the settings themselves untouched.
2. Add Anki card addition as another flashcard category, so that it can be selected on long tap on + icon.
3. Allow to select more than one category for adding to. Like, say, ticking "Category_1", "Category_2" and "Anki card" and then press on 'submit'. Of course, allow to set in options to leave the classic behaviour untouched.
4. (this is not about sync, but about flashcards, I waited long to report this to you) Allow the option to save (or merge into one) duplicate cards when the hanzi look the same but not actually the same, like 横 hèng harsh and unreasonable, and 横 héng horizontal, often being the result of simplification of two different hanzi into one.
A single hanzi unit isn't just a written image, but an idea, an undividable combination of image, tone and syllable, plus meaning, and as such I'm sure shall be differentiated based on complex of all these things
 

mikelove

皇帝
Staff member
1. Not to divide 2 flashcard systems (Pleco and Anki) in settings, but allow them both in the same time. Keeping the settings themselves untouched.

This is how it already works - basically we have an "Anki Decks" test profile with a separate scorefile for each numbered card 'side.' (taking advantage of the fact that an Anki card can never appear in more than one standard deck) So if you import a bunch of Anki cards and the maximum # of sides on any of your card models is 4 then you end up with an Anki Decks profile and 4 Anki scorefiles hidden underneath it, with your notes now cards and your cards now merely records in the appropriate scorefile. You tap on that profile and are taken to a familiar-to-Anki-users configuration screen with a list of decks, due cards in each, deck settings, etc.

But the cards are standard cards, mapped to the greatest extent possible to standard card fields, so you can also ignore all of that and test them in an unrelated Pleco profile - only downside is that since Anki has no concept of duplicate cards you're liable to end up with a bunch of duplicates. (we do now have a 'merge duplicates' batch function though)

2. Add Anki card addition as another flashcard category, so that it can be selected on long tap on + icon.

Also supported, categories correspond to Anki decks and if you add a regular old flashcard to an Anki deck then it gets treated like an Anki card. But in order to avoid odd / un-Anki-like behavior, cards can only belong to a single Anki deck category at a time. (we also create categories for Anki tags, which of course are not subject to that restriction)

(we've put a LOT of thought into this - gone through half a dozen different versions of the above two systems - so while it's not perfect it's the best solution we've come up with that doesn't force us to change the basic design of our own flashcard system)

3. Allow to select more than one category for adding to. Like, say, ticking "Category_1", "Category_2" and "Anki card" and then press on 'submit'. Of course, allow to set in options to leave the classic behaviour untouched.

Makes sense. (and not hard to add)

4. (this is not about sync, but about flashcards, I waited long to report this to you) Allow the option to save (or merge into one) duplicate cards when the hanzi look the same but not actually the same, like 横 hèng harsh and unreasonable, and 横 héng horizontal, often being the result of simplification of two different hanzi into one.

In theory if you wanted to come up with the list of characters like this yourself you could do that in the current design; you'd just create a text processor that collapsed all of the 横's to the same character and use that in a custom merge search. I don't think it's something we're likely to support officially in the near future but the potential is there.
 

Cameroon

探花
Thanks for your detailed reply!

while it's not perfect it's the best solution we've come up with that doesn't force us to change the basic design of our own flashcard system

Exactly, the native flashcard system shall be untouched! I'm completely pro that.
What I meant was, not to switch Pleco's and Anki's system in core settings but instead add Anki flashcard system functionality as a supplement to the unchanged Pleco's system.

To make it short, this idea only needs the implementation of the feature mentioned below (to add Anki's card creation (to the currently available Pleco's flashcards' categories selection menu) on long-tap of the '+' button (while still in Pleco's native flashcard system):

3. Allow to select more than one category for adding to. Like, say, ticking "Category_1", "Category_2" and "Anki card" and then press on 'submit'. Of course, allow to set in options to leave the classic behaviour untouched.
Makes sense. (and not hard to add)

Settings for the structure (model/fields) of the Anki cards being created inside Pleco are already present, so nothing new has to be developed.

Simply put, the proposal isn't to change anything neither in Pleco's native nor in Anki-style inner flashcard subsystems of Pleco.
Instead, I propose to allow these two subsystems coexistence, allow them both to be activated and working simultaneously.
I guess there couldn't be any compatibility issues, but maybe I'm wrong?
 
Last edited:

mikelove

皇帝
Staff member
Simply put, the proposal isn't to change anything neither in Pleco's native nor in Anki-style inner flashcard subsystems of Pleco.
Instead, I propose to allow these two subsystems coexistence, allow them both to be activated and working simultaneously.
I guess there couldn't be any compatibility issues, but maybe I'm wrong?

This is pretty much what I was describing, actually. Can add Anki cards to non-Anki profiles or non-Anki cards to Anki profiles; as long as the fields are set up correctly it should work fine.
 

Cameroon

探花
This is pretty much what I was describing, actually
Great to hear that! I'm a bit having hard times finding the rights words ))
if your Anki profile equals my Anki-styled flashcard subsystem of Pleco :cool:
and your non-Anki profile equals my Pleco native flashcard subsystem
then this implementation would be very handy to use!
Not sure though why will those two different profiles be still needed then at all? If they don't put any more restrictions on any type flashcard creation?
Anyway, there are so many inner issues I don't know that I don't even dare to bother Mike with it and will just sit and wait for when the best becomes even better ))
 

mikelove

皇帝
Staff member
Not sure though why will those two different profiles be still needed then at all? If they don't put any more restrictions on any type flashcard creation?

This is a “profile” in the Pleco sense of it, I.e. a set of test settings you can pick to run a test on.
 

Cameroon

探花
This is a “profile” in the Pleco sense of it, I.e. a set of test settings you can pick to run a test on.
I see, so my perception was wrong ((

So there isn't any perspective in the future to be able to add full-featured Anki cards to Anki (as if you chose Anki as Pleco's flashcard system) while staying in Pleco's own (native) flashcard system?

I.e., when your settings are:
1636289840794.png

And you tap on the '+' buttons (any of them):
1636289917059.png

Then when you see this menu, there would be the additional 'Anki card' item:
1636290706241.png

So after you tap on the 'Anki...' item, you would be able to see something like this:
1636290024432.png

While nowadays, you're only able to see this if you have settings like that:
1636290091636.png
 
Last edited:

mikelove

皇帝
Staff member
Ah, no, we’re not currently planning to let people simultaneously use the Anki API and our own system; there are a whole lot of behind the scenes behavior changes needed to get that API to work well in our app and we can’t seamlessly mix those with our own system.
 

Cameroon

探花
Understood.
Can at least this setting (trigger Anki/Pleco flashcard system) be also put somewhere not so deep in settings? Not moved, but duplicated.
Like we have now with day/night mode and simp/trad chinese: they are present in settings, but we can also reach them quickly via the corresponding triggers in the upper part of the sliding sidebar. May it be the solution? (of course, as a switchable option, so that those who don't need it, won't be bothered by it)
 
Last edited:

mikelove

皇帝
Staff member
We’re actually planning to offer a “Pleco Legacy” app along with our new app for at least a few years, installed separately and with its own set of settings, so since Anki API integration is pretty much the same either way, maybe you could have that configured to link to Anki and the other app using its own system?

(the new app uses bottom tab navigation instead of a sidebar so there isn’t necessarily a super convenient place to put that toggle)
 

Cameroon

探花
Thank you, I see that this toggle could happen not to be granted the precious space in the new bottom bar, well, that's rude reality, no complaints ))
And it would be a waste of efforts to embed it into the current (soon legacy) version.

Given that I seem to be the only one user here with such custom a wish, I twice appreciate your attention.
have that configured to link to Anki and the other app using its own system
I'm afraid that switching between legacy and new-style Plecos will be more complex and time consuming than even the current need to change the active flashcard system in the depths of program's settings.
With two Plecos I'll have to consequentially search for the target headword in the old Pleco, then in the new one, and tick '+' in both of them to fulfill this task. Guess I'll have to rethink my conception of syncing new words between PC and handheld, the solution is always somewhere out here ))

As my aim was to (ideally) create two flashcards with the same heading simultaneously both in Pleco and in Anki with a single click on the '+' sign in Pleco (but that turned out not to be possible) -
I guess it still would have been a rather quick way to execute the following:

1. Tap + in one flashcard system.
2. Then swipe to call sidebar.
3. Tap toggle switch to another flashcard system.
4. Swipe the sidebar away, then in dictionary view (or where you previously were assuming the + sign is present there), tap + again.

And that's it!
In a couple of taps and swipes we've just created a pair of same (same headings) cards both in Anki and Pleco.

This way would have been still quite acceptable I guess, no much hassle / time waste here.
But alas, see the beginning of this post ((
 
Last edited:
Top