@premsheth wrote:
Hi,
I am stuck in one problem
I am checking word is it in vector or not by measuring distance.
I used stringdist package
my code is below
s1 <- c("Business Head", "Recruitment Manager","CEO of interimarket", "Executive", "Accountant")
s2 <- c("Head")
stringdist(s2,s1, method = "jaccard")
i got minimum distance 0.6 for “Head” word but I want to return word “Head” not minimum distance
My ultimate goal is getting words which has minimum distance:
For example:
s1 <- c("Business Head", "Recruitment Manager",
"CEO of interimarket",
"Executive", "Accountant")
s2 <- c("Head","CEO","Account")
d <- matrix(, nrow = length(s2), ncol = length(s1))
for(i in 1:length(s2)){
d[i,] <- stringdist(s2[i],s1, method = "jaccard")
}
d
[,1] [,2] [,3] [,4] [,5]
[1,] 0.6000000 0.8666667 0.8750000 0.9090909 0.9000000
[2,] 1.0000000 1.0000000 0.7857143 0.9000000 1.0000000
[3,] 0.8571429 0.7333333 0.8235294 0.7272727 0.1428571
i will run above code with S1 and s2 i got matrix but now I want to word which have minimum distance.
How can I get that?
please let me knowThanks in Advance
Posts: 3
Participants: 2