Gevorderde reguliere expressies in R
Angelo Zehr
Data Journalist

Gewone Levenshtein-afstand:
stringdist(a, b, method = "lv")
Damerau–Levenshtein-afstand:
stringdist(a, b, method = "dl")
Optimal String Alignment-afstand:
stringdist(a, b, method = "osa")


qgrams("Honolulu", "Hanolulu", q = 2)
Retourneert:
Ho on ul no ol lu la
V1 1 1 1 1 1 2 0
V2 1 1 1 1 1 1 1
Som van niet-gedeelde q-grams
stringdist(a, b, method = "qgram") # equals 4
Niet-gedeelde q-grams gedeeld door totaal aantal q-grams
stringdist(a, b, method = "jaccard") # equals 0.5
Optimal String Alignment-afstand
stringdist(a, b, method = "cosine") # equals 0.22
Gevorderde reguliere expressies in R