/** * Tests the string edit distance function. */ public static void main(String[] args) { String[] s = {"there once was a man", "this one is a manic", "hey there", "there once was a mane", "once in a manger.", "where is one match?", "Jo3seph Smarr!", "Joseph R Smarr"}; for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { System.out.println("s1: " + s[i]); System.out.println("s2: " + s[j]); System.out.println("edit distance: " + editDistance(s[i], s[j])); System.out.println("LCS: " + longestCommonSubstring(s[i], s[j])); System.out.println("LCCS: " + longestCommonContiguousSubstring(s[i], s[j])); System.out.println(); } } }
addFeature(features, "partial-match", relaxedStringMatch(m1, m2)); double editDistance = StringUtils.editDistance(m1.spanToString(), m2.spanToString()) / (double) (m1.spanToString().length() + m2.spanToString().length()); features.incrementCount("edit-distance", editDistance); features.incrementCount("edit-distance=" + ((int)(editDistance * 10) / 10.0)); double headEditDistance = StringUtils.editDistance(m1.headString, m2.headString) / (double) (m1.headString.length() + m2.headString.length()); features.incrementCount("head-edit-distance", headEditDistance);
/** * Tests the string edit distance function. */ public static void main(String[] args) { String[] s = {"there once was a man", "this one is a manic", "hey there", "there once was a mane", "once in a manger.", "where is one match?", "Jo3seph Smarr!", "Joseph R Smarr"}; for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { System.out.println("s1: " + s[i]); System.out.println("s2: " + s[j]); System.out.println("edit distance: " + editDistance(s[i], s[j])); System.out.println("LCS: " + longestCommonSubstring(s[i], s[j])); System.out.println("LCCS: " + longestCommonContiguousSubstring(s[i], s[j])); System.out.println(); } } }
/** * Tests the string edit distance function. */ public static void main(String[] args) { String[] s = {"there once was a man", "this one is a manic", "hey there", "there once was a mane", "once in a manger.", "where is one match?", "Jo3seph Smarr!", "Joseph R Smarr"}; for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { System.out.println("s1: " + s[i]); System.out.println("s2: " + s[j]); System.out.println("edit distance: " + editDistance(s[i], s[j])); System.out.println("LCS: " + longestCommonSubstring(s[i], s[j])); System.out.println("LCCS: " + longestCommonContiguousSubstring(s[i], s[j])); System.out.println(); } } }
/** * Tests the string edit distance function. */ public static void main(String[] args) { String[] s = {"there once was a man", "this one is a manic", "hey there", "there once was a mane", "once in a manger.", "where is one match?", "Jo3seph Smarr!", "Joseph R Smarr"}; for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { System.out.println("s1: " + s[i]); System.out.println("s2: " + s[j]); System.out.println("edit distance: " + editDistance(s[i], s[j])); System.out.println("LCS: " + longestCommonSubstring(s[i], s[j])); System.out.println("LCCS: " + longestCommonContiguousSubstring(s[i], s[j])); System.out.println(); } } }
/** * Tests the string edit distance function. */ public static void main(String[] args) { String[] s = {"there once was a man", "this one is a manic", "hey there", "there once was a mane", "once in a manger.", "where is one match?", "Jo3seph Smarr!", "Joseph R Smarr"}; for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { System.out.println("s1: " + s[i]); System.out.println("s2: " + s[j]); System.out.println("edit distance: " + editDistance(s[i], s[j])); System.out.println("LCS: " + longestCommonSubstring(s[i], s[j])); System.out.println("LCCS: " + longestCommonContiguousSubstring(s[i], s[j])); System.out.println(); } } }
addFeature(features, "partial-match", relaxedStringMatch(m1, m2)); double editDistance = StringUtils.editDistance(m1.spanToString(), m2.spanToString()) / (double) (m1.spanToString().length() + m2.spanToString().length()); features.incrementCount("edit-distance", editDistance); features.incrementCount("edit-distance=" + ((int)(editDistance * 10) / 10.0)); double headEditDistance = StringUtils.editDistance(m1.headString, m2.headString) / (double) (m1.headString.length() + m2.headString.length()); features.incrementCount("head-edit-distance", headEditDistance);