File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
src/main/java/info/debatty/java/stringsimilarity Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 77 <modelVersion >4.0.0</modelVersion >
88 <groupId >info.debatty</groupId >
99 <artifactId >java-string-similarity</artifactId >
10- <version >0.3 </version >
10+ <version >0.4 </version >
1111 <packaging >jar</packaging >
1212
1313 <name >${project.artifactId} </name >
Original file line number Diff line number Diff line change 22
33import java .io .Serializable ;
44import java .security .InvalidParameterException ;
5+ import java .util .ArrayList ;
56import java .util .HashSet ;
7+ import java .util .Set ;
68
79/**
810 * A k-shingling is a set of unique k-grams, used to measure the similarity of
@@ -101,4 +103,17 @@ public boolean[] booleanVectorOf(String s) {
101103 return r ;
102104 }
103105
106+ public Set <Integer > integerSetOf (String s ) {
107+ Set <Integer > set = new HashSet <Integer >();
108+ int i = 0 ;
109+ for (String shingle : this ) {
110+ if (s .contains (shingle )) {
111+ set .add (i );
112+ }
113+ i ++;
114+ }
115+
116+ return set ;
117+ }
118+
104119}
You can’t perform that action at this time.
0 commit comments