zachalmers / Anki_Tagger

Given a pdf lecture guide or folder of such files, this codebase will find and tag the best anki cards within a given deck.
16 stars 7 forks source link

Errors in the last step #10

Open yalehackmentalhealth opened 1 month ago

yalehackmentalhealth commented 1 month ago

Hello! I am running into issues with the last step of the process, tag_deck.py.

I noticed that when I run the code and look through the temp_folder, there is .anki2 and .anki21b, but no .anki21 file.

When I run the code, I also found that there is only 1 GUID contained in the .anki2 file, the following outputs, with no GUID matches:

"guid not found for card:

Match the cutaneous finding with the bug(s) - these sound very alike!
. . . guid not found for card: The antifungal class allylamines can be recognized via the suffix "{{c1::-fine}}" guid not found for card:
Carbidopa {{c1::decreases}} the peripheral side effects of levodopa
Tagged 0 cards. Process Complete"

I tried to use print statements to debug, but here was the result, which said that there is only 1 GUID in the Anki collection.

Initialize a new collection

col = Collection(os.path.join(temp_folder, anki2_file[0]))
tagged = set()

print("Tagged Cards in Set", tagged)

# Get all GUIDs from the Anki collection as a dictionary for fast lookup
all_notes = col.db.all("SELECT id, guid, tags FROM notes")
note_dict = {guid: (note_id, tags) for note_id, guid, tags in all_notes}
print(f"Total GUIDs in Anki collection: {len(note_dict)}")

This part seems to be the issue because there is only 1 GUID in the Anki collection, and it turns out there is only one note.

"Selected file: collection.anki2 Raw notes data: [[1723081608240, 'Gp.y|k,m)5', 1723081608239, 1723081608, -1, '', 'Please update to the latest Anki version, then import the .colpkg/.apkg file again.\x1f', 'Please update to the latest Anki version, then import the .colpkg/.apkg file again.', 871165352, 0, '']]"

Could you help me please

zachalmers commented 1 month ago

If there is only one GUID in the collection then you must be pointing at the wrong collection file. Maybe try the anki21b one? I havent run it in a while so its also possible that the collection structure has changed

On Thu, Aug 8, 2024 at 9:42 PM yalehackmentalhealth < @.***> wrote:

Hello! I am running into issues with the last step of the process, tag_deck.py.

I noticed that when I run the code and look through the temp_folder, there is .anki2 and .anki21b, but no .anki21 file.

When I run the code, I also found that there is only 1 GUID contained in the .anki2 file, the following outputs, with no GUID matches:

"guid not found for card: Match the cutaneous finding with the bug(s) - these sound very alike!

. . . guid not found for card: The antifungal class allylamines can be recognized via the suffix "{{c1::-fine}}" guid not found for card: Carbidopa {{c1::decreases}} the peripheral side effects of levodopa

Tagged 0 cards. Process Complete"

I tried to use print statements to debug, but here was the result, which said that there is only 1 GUID in the Anki collection. Initialize a new collection

col = Collection(os.path.join(temp_folder, anki2_file[0])) tagged = set()

print("Tagged Cards in Set", tagged)

Get all GUIDs from the Anki collection as a dictionary for fast lookup

all_notes = col.db.all("SELECT id, guid, tags FROM notes") note_dict = {guid: (note_id, tags) for note_id, guid, tags in all_notes} print(f"Total GUIDs in Anki collection: {len(note_dict)}")

This part seems to be the issue because there is only 1 GUID in the Anki collection, and it turns out there is only one note.

"Selected file: collection.anki2 Raw notes data: [[1723081608240, 'Gp.y|k,m)5', 1723081608239, 1723081608, -1, '', 'Please update to the latest Anki version, then import the .colpkg/.apkg file again.\x1f', 'Please update to the latest Anki version, then import the .colpkg/.apkg file again.', 871165352, 0, '']]"

Could you help me please

— Reply to this email directly, view it on GitHub https://github.com/zachalmers/Anki_Tagger/issues/10, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABV3P6WING6MLSAI4MUNXGLZQQUBTAVCNFSM6AAAAABMHTV72OVHI2DSMVQWIX3LMV43ASLTON2WKOZSGQ2TMOJYGI3DSMY . You are receiving this because you are subscribed to this thread.Message ID: @.***>