Skip to content

Instantly share code, notes, and snippets.

Avatar

S R C sroycode

  • Vnaad Technologies LLP
  • Bangalore, India
View GitHub Profile
@sroycode
sroycode / item.txt
Created April 16, 2020 19:37
Testing DuckDB Scripts
View item.txt
2001|1|www.badshop.com|electronics|Electronics Something Four|DDDDDD|green|M11
2002|2|www.goodshop.com|electronics|Electronics Something Five|PPPP|yellow|F22
2003|3|www.badshop.com|electronics|Electronics Something Six|AAAAA|orange|U33
2004|4|www.goodshop.com|electronics|Electronics Something Seven|BBBBB|red|M11
2005|5|www.badshop.com|electronics|Electronics Something Eight|CCCC|violet|F22
2006|6|www.goodshop.com|electronics|Electronics Something Nine|DDDDDD|indigo|U33
2007|7|www.badshop.com|electronics|Electronics Something Ten|PPPP|blue|M11
2008|8|www.goodshop.com|electronics|Electronics Something One|AAAAA|green|F22
2009|9|www.badshop.com|electronics|Electronics Something Two|BBBBB|yellow|U33
2010|10|www.goodshop.com|electronics|Electronics Something Three|CCCC|orange|M11
@sroycode
sroycode / dldist.cc
Created June 25, 2018 10:45
DL Distance
View dldist.cc
static inline int levenshtein_dist(const int depth, const char p, const char c, const unsigned char* term, const int term_len,
const int* irow, const int* jrow, int* krow)
{
int row_min = std::numeric_limits<int>::max();
const int columns = term_len+1;
krow[0] = jrow[0] + 1;
// Calculate levenshtein distance incrementally (j => column, b => term):
// https://en.wikipedia.org/wiki/Damerau%E2%80%93Levenshtein_distance#Optimal_string_alignment_distance