-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Hi, amazing paper and thanks for the work you have done.
I am trying to implement Levenshtein Distance, but been totally unsuccessful. I cannot find IndexAssign2D mentioned in the paper. I tried to follow the examples and tried to recreate, but was unsuccessful. I will put down the code at the end. If you have working code already somewhere, i would love to see it :)
levenshtein_distance = Algorithm(
Input('inp'),
Input('out'),
#get length of first string
VarInt('s', lambda inp: inp.shape[-1]),
#get length of second string
VarInt('t', lambda out: out.shape[-1]),
# Not sure how to assign max length to 'n'
VarInt('n', lambda t: t),
# can't use 'n' here to instantiate dynamic tensor
# Var('d', torch.zeros((n, n))),
Var('d', torch.zeros((5, 5))),
# ====== unable to move ahead from here ======
# For('i', 'n',
# Set the i+1 th element of array to a
# Let('d', lambda i: [i + 1, i*0], lambda i: i + 1)),
# Print(lambda d: d),
Output('d'),
beta=1.25,
)
# int representation of the input strings
i, o = torch.tensor([[3,4,1]]), torch.tensor([[8,3,4,1]])
levenshtein_distance(i, o)
dgcnz, Felix-Petersen and Zixuan-Bai
Metadata
Metadata
Assignees
Labels
No labels