Feeling a little iffy on this function to calculate the mean edit distances of a list of words...


take 2 on this tricky "calculate mean edit distance of list of words"


Feel like there's a way to cut the time in half?

@schlink Yep. There is. More like this...
for i = 0..list.len() {
for j = 0 .. i - 1 {
let this_edit_distance = find_edit_distance(list[i], list[j]);


@schlink The trick is to make a table. The list of words on the X axis, the list of words on the Y axis. You know you don't need the diagonal in that table (comparing index i to index i). You also don't need anything past that diagonal because that'll be a double compare.

· · Web · 0 · 0 · 1
Sign in to participate in the conversation
TableToot: Chatter for Tabletop Gamers

Tabletop gaming chatter in a moderated space. An inclusive community we'd like to hang out in.