Jaro distance in MMA

Clash Royale CLAN TAG#URR8PPP
up vote
4
down vote
favorite
I'm trying to program Jaro distance as requested by this page I've done the following code that works well for the next two pairs ("MARTHA", "MARHTA") and ("DIXON", "DICKSONX") but when I try with ("JELLYFISH", "SMELLYFISH") I get an error because the code counts the double S of "SMELLYFISH", due to this error I have not been able to finish successfully, here is what I have programmed up to this moment
uno = "DIXON"; dos ="DICKSONX" ;
rep = Characters[uno] [Intersection] Characters[dos]
scope = Max[StringLength[uno], StringLength[dos]]/2 - 1
inter = Transpose[Flatten[Position[Characters[uno], #] & /@ rep],
Flatten[Position[Characters[dos], #] & /@ rep]]
m = Select[inter, Abs[#[[1]] - #[[2]]] < scope &]
prb = Select[m, #[[1]] != #[[2]] &]
trans = Length[DeleteCases[Position[prb, Reverse[#]] & /@ prb, ]]/2
1/3 (Length[m]/StringLength[uno] + Length[m]/StringLength[dos] + (
Length[m] - trans)/Length[m])
% // N
Someone who can help me solve this problem? Maybe the approach I'm using is wrong, I hope someone is interested in this problem too. Thanks in advance
list-manipulation function-construction programming string-manipulation
add a comment |Â
up vote
4
down vote
favorite
I'm trying to program Jaro distance as requested by this page I've done the following code that works well for the next two pairs ("MARTHA", "MARHTA") and ("DIXON", "DICKSONX") but when I try with ("JELLYFISH", "SMELLYFISH") I get an error because the code counts the double S of "SMELLYFISH", due to this error I have not been able to finish successfully, here is what I have programmed up to this moment
uno = "DIXON"; dos ="DICKSONX" ;
rep = Characters[uno] [Intersection] Characters[dos]
scope = Max[StringLength[uno], StringLength[dos]]/2 - 1
inter = Transpose[Flatten[Position[Characters[uno], #] & /@ rep],
Flatten[Position[Characters[dos], #] & /@ rep]]
m = Select[inter, Abs[#[[1]] - #[[2]]] < scope &]
prb = Select[m, #[[1]] != #[[2]] &]
trans = Length[DeleteCases[Position[prb, Reverse[#]] & /@ prb, ]]/2
1/3 (Length[m]/StringLength[uno] + Length[m]/StringLength[dos] + (
Length[m] - trans)/Length[m])
% // N
Someone who can help me solve this problem? Maybe the approach I'm using is wrong, I hope someone is interested in this problem too. Thanks in advance
list-manipulation function-construction programming string-manipulation
add a comment |Â
up vote
4
down vote
favorite
up vote
4
down vote
favorite
I'm trying to program Jaro distance as requested by this page I've done the following code that works well for the next two pairs ("MARTHA", "MARHTA") and ("DIXON", "DICKSONX") but when I try with ("JELLYFISH", "SMELLYFISH") I get an error because the code counts the double S of "SMELLYFISH", due to this error I have not been able to finish successfully, here is what I have programmed up to this moment
uno = "DIXON"; dos ="DICKSONX" ;
rep = Characters[uno] [Intersection] Characters[dos]
scope = Max[StringLength[uno], StringLength[dos]]/2 - 1
inter = Transpose[Flatten[Position[Characters[uno], #] & /@ rep],
Flatten[Position[Characters[dos], #] & /@ rep]]
m = Select[inter, Abs[#[[1]] - #[[2]]] < scope &]
prb = Select[m, #[[1]] != #[[2]] &]
trans = Length[DeleteCases[Position[prb, Reverse[#]] & /@ prb, ]]/2
1/3 (Length[m]/StringLength[uno] + Length[m]/StringLength[dos] + (
Length[m] - trans)/Length[m])
% // N
Someone who can help me solve this problem? Maybe the approach I'm using is wrong, I hope someone is interested in this problem too. Thanks in advance
list-manipulation function-construction programming string-manipulation
I'm trying to program Jaro distance as requested by this page I've done the following code that works well for the next two pairs ("MARTHA", "MARHTA") and ("DIXON", "DICKSONX") but when I try with ("JELLYFISH", "SMELLYFISH") I get an error because the code counts the double S of "SMELLYFISH", due to this error I have not been able to finish successfully, here is what I have programmed up to this moment
uno = "DIXON"; dos ="DICKSONX" ;
rep = Characters[uno] [Intersection] Characters[dos]
scope = Max[StringLength[uno], StringLength[dos]]/2 - 1
inter = Transpose[Flatten[Position[Characters[uno], #] & /@ rep],
Flatten[Position[Characters[dos], #] & /@ rep]]
m = Select[inter, Abs[#[[1]] - #[[2]]] < scope &]
prb = Select[m, #[[1]] != #[[2]] &]
trans = Length[DeleteCases[Position[prb, Reverse[#]] & /@ prb, ]]/2
1/3 (Length[m]/StringLength[uno] + Length[m]/StringLength[dos] + (
Length[m] - trans)/Length[m])
% // N
Someone who can help me solve this problem? Maybe the approach I'm using is wrong, I hope someone is interested in this problem too. Thanks in advance
list-manipulation function-construction programming string-manipulation
list-manipulation function-construction programming string-manipulation
asked Aug 18 at 23:05
bullitohappy
590217
590217
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
6
down vote
accepted
As an alternative you can use Experimental`JaroDistance:
jD = Experimental`JaroDistance;
jD[uno, dos]
0.766667
jD["JELLYFISH", "SMELLYFISH"]
0.896296
thank you very much for the information has been very useful, since actually get the expected results, I did not know about that package, but I would like to performance my own version of that function, and check it with the option you proposed, I hope please You can help improve my programming attempt since you have more experience than me. Hoping to have your help, I say goodbye, wishing you an excellent day
â bullitohappy
Aug 20 at 5:22
Please, take a look at the solution proposed in the wolfram community, here is the link community.wolfram.com/groups/-/m/t/1416937 , I think it is very accurate, but I do not understand what the author of the answer is asking for, since he has already tried his function and fails, now I am trying to find the solution to the problem with the code he shared. Thanks for your help here on stack exchange, and vote for your answer
â bullitohappy
Aug 21 at 23:13
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
6
down vote
accepted
As an alternative you can use Experimental`JaroDistance:
jD = Experimental`JaroDistance;
jD[uno, dos]
0.766667
jD["JELLYFISH", "SMELLYFISH"]
0.896296
thank you very much for the information has been very useful, since actually get the expected results, I did not know about that package, but I would like to performance my own version of that function, and check it with the option you proposed, I hope please You can help improve my programming attempt since you have more experience than me. Hoping to have your help, I say goodbye, wishing you an excellent day
â bullitohappy
Aug 20 at 5:22
Please, take a look at the solution proposed in the wolfram community, here is the link community.wolfram.com/groups/-/m/t/1416937 , I think it is very accurate, but I do not understand what the author of the answer is asking for, since he has already tried his function and fails, now I am trying to find the solution to the problem with the code he shared. Thanks for your help here on stack exchange, and vote for your answer
â bullitohappy
Aug 21 at 23:13
add a comment |Â
up vote
6
down vote
accepted
As an alternative you can use Experimental`JaroDistance:
jD = Experimental`JaroDistance;
jD[uno, dos]
0.766667
jD["JELLYFISH", "SMELLYFISH"]
0.896296
thank you very much for the information has been very useful, since actually get the expected results, I did not know about that package, but I would like to performance my own version of that function, and check it with the option you proposed, I hope please You can help improve my programming attempt since you have more experience than me. Hoping to have your help, I say goodbye, wishing you an excellent day
â bullitohappy
Aug 20 at 5:22
Please, take a look at the solution proposed in the wolfram community, here is the link community.wolfram.com/groups/-/m/t/1416937 , I think it is very accurate, but I do not understand what the author of the answer is asking for, since he has already tried his function and fails, now I am trying to find the solution to the problem with the code he shared. Thanks for your help here on stack exchange, and vote for your answer
â bullitohappy
Aug 21 at 23:13
add a comment |Â
up vote
6
down vote
accepted
up vote
6
down vote
accepted
As an alternative you can use Experimental`JaroDistance:
jD = Experimental`JaroDistance;
jD[uno, dos]
0.766667
jD["JELLYFISH", "SMELLYFISH"]
0.896296
As an alternative you can use Experimental`JaroDistance:
jD = Experimental`JaroDistance;
jD[uno, dos]
0.766667
jD["JELLYFISH", "SMELLYFISH"]
0.896296
answered Aug 18 at 23:20
kglr
161k8185384
161k8185384
thank you very much for the information has been very useful, since actually get the expected results, I did not know about that package, but I would like to performance my own version of that function, and check it with the option you proposed, I hope please You can help improve my programming attempt since you have more experience than me. Hoping to have your help, I say goodbye, wishing you an excellent day
â bullitohappy
Aug 20 at 5:22
Please, take a look at the solution proposed in the wolfram community, here is the link community.wolfram.com/groups/-/m/t/1416937 , I think it is very accurate, but I do not understand what the author of the answer is asking for, since he has already tried his function and fails, now I am trying to find the solution to the problem with the code he shared. Thanks for your help here on stack exchange, and vote for your answer
â bullitohappy
Aug 21 at 23:13
add a comment |Â
thank you very much for the information has been very useful, since actually get the expected results, I did not know about that package, but I would like to performance my own version of that function, and check it with the option you proposed, I hope please You can help improve my programming attempt since you have more experience than me. Hoping to have your help, I say goodbye, wishing you an excellent day
â bullitohappy
Aug 20 at 5:22
Please, take a look at the solution proposed in the wolfram community, here is the link community.wolfram.com/groups/-/m/t/1416937 , I think it is very accurate, but I do not understand what the author of the answer is asking for, since he has already tried his function and fails, now I am trying to find the solution to the problem with the code he shared. Thanks for your help here on stack exchange, and vote for your answer
â bullitohappy
Aug 21 at 23:13
thank you very much for the information has been very useful, since actually get the expected results, I did not know about that package, but I would like to performance my own version of that function, and check it with the option you proposed, I hope please You can help improve my programming attempt since you have more experience than me. Hoping to have your help, I say goodbye, wishing you an excellent day
â bullitohappy
Aug 20 at 5:22
thank you very much for the information has been very useful, since actually get the expected results, I did not know about that package, but I would like to performance my own version of that function, and check it with the option you proposed, I hope please You can help improve my programming attempt since you have more experience than me. Hoping to have your help, I say goodbye, wishing you an excellent day
â bullitohappy
Aug 20 at 5:22
Please, take a look at the solution proposed in the wolfram community, here is the link community.wolfram.com/groups/-/m/t/1416937 , I think it is very accurate, but I do not understand what the author of the answer is asking for, since he has already tried his function and fails, now I am trying to find the solution to the problem with the code he shared. Thanks for your help here on stack exchange, and vote for your answer
â bullitohappy
Aug 21 at 23:13
Please, take a look at the solution proposed in the wolfram community, here is the link community.wolfram.com/groups/-/m/t/1416937 , I think it is very accurate, but I do not understand what the author of the answer is asking for, since he has already tried his function and fails, now I am trying to find the solution to the problem with the code he shared. Thanks for your help here on stack exchange, and vote for your answer
â bullitohappy
Aug 21 at 23:13
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f180222%2fjaro-distance-in-mma%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password