Skip to content

Instantly share code, notes, and snippets.

View kornkaobat's full-sized avatar
🎯
Focusing

kornkaobat

🎯
Focusing
  • Bangkok
View GitHub Profile
@cryptocoinserver
cryptocoinserver / AnkiCardSimilarity.py
Last active May 19, 2024 21:48
This script checks for similar cards in a deck and adds tags to them. It uses TF-IDF and cosine similarity to calculate the similarity between cards. It connects to the Anki collection with ankipandas. Anki needs to be closed while running it. For the changes to show in Anki "Tools" > "Check database" before "Browse".
import os
import re
import sqlite3
import zipfile
import numpy as np
import pandas as pd
import spacy
from ankipandas import Collection
from sklearn.feature_extraction.text import TfidfVectorizer