Beispiel #1
0
        public static SqlString longestSubSequence(SqlString string1, SqlString string2)
        {
            var compString = new CompStrings(string1, string2);
            var sdist      = new StringDist(compString.from, compString.to);

            return(new SqlString(sdist.longestSubSequence()));
        }
Beispiel #2
0
        public static SqlDouble sorensenDistance(SqlString string1, SqlString string2)
        {
            var compString = new CompStrings(string1, string2);
            var sdist      = new StringDist(compString.from, compString.to);

            return(new SqlDouble(sdist.sorensenDistance()));
        }
Beispiel #3
0
        public static SqlDouble overlap(SqlString string1, SqlString string2)
        {
            var compString = new CompStrings(string1, string2);
            var sdist      = new StringDist(compString.from, compString.to);

            return(new SqlDouble(sdist.overlap()));
        }
Beispiel #4
0
        public static SqlDouble tanimotoCoefficient(SqlString string1, SqlString string2)
        {
            var compString = new CompStrings(string1, string2);
            var sdist      = new StringDist(compString.from, compString.to);

            return(new SqlDouble(sdist.tanimotoCoefficient()));
        }
Beispiel #5
0
        public static SqlDouble levenshteinNormalized(SqlString string1, SqlString string2)
        {
            var compString = new CompStrings(string1, string2);
            var sdist      = new StringDist(compString.from, compString.to);

            return(new SqlDouble(sdist.levenshteinNormalized()));
        }
Beispiel #6
0
        public static SqlDouble jaroWinklerPrefix(SqlString string1, SqlString string2, SqlDouble scale)
        {
            var compString = new CompStrings(string1, string2);
            var sdist      = new StringDist(compString.from, compString.to);

            return(new SqlDouble(sdist.jaroWinklerPrefix((double)scale)));
        }
Beispiel #7
0
        public static SqlDouble jaroWinkler(SqlString string1, SqlString string2)
        {
            var compString = new CompStrings(string1, string2);
            var sdist      = new StringDist(compString.from, compString.to);

            return(new SqlDouble(sdist.jaroWinkler()));
        }
        public static IEnumerable GetStringDistances(String query) {

            ArrayList returnValues = new ArrayList();

            using (SqlConnection connection = new SqlConnection("context connection=true")) {

                connection.Open();

                using (SqlCommand dataTable = new SqlCommand(query, connection)) {

                    using (SqlDataReader row = dataTable.ExecuteReader()) {
                        while (row.Read()) {

                            CompStrings comparisonStrings = new CompStrings(row.GetSqlString(0), row.GetSqlString(1));
                            StringDist dists = new StringDist(comparisonStrings.from, comparisonStrings.to);
                            returnValues.Add(new AllDistanceMetrics(comparisonStrings.from, comparisonStrings.to, 
                                dists.hamming(), dists.jaccard(), dists.jaro(), dists.jaroWinkler(), 
                                dists.levenshtein(), dists.levenshteinLower(), dists.levenshteinUpper(),
                                dists.levenshteinNormalized(), dists.overlap(), dists.ratcliff(), dists.sorensenIndex(),
                                dists.sorensenDistance(), dists.tanimotoCoefficient()));
                        }
                    }
                }
            }
            return returnValues;
        }
Beispiel #9
0
        public static SqlBoolean approximatelySame(SqlString string1, SqlString string2,
                                                   SqlString comparisonOptions, SqlString toleranceOptions)
        {
            var compString = new CompStrings(string1, string2,
                                             toleranceOptions, comparisonOptions);
            var sdist = new StringDist(compString.from, compString.to);

            return(new SqlBoolean(sdist.approxSame(compString.comp, compString.tolerance)));
        }
Beispiel #10
0
        public static IEnumerable GetStringDistances(String query)
        {
            ArrayList returnValues = new ArrayList();

            using (SqlConnection connection = new SqlConnection("context connection=true")) {
                connection.Open();

                using (SqlCommand dataTable = new SqlCommand(query, connection)) {
                    using (SqlDataReader row = dataTable.ExecuteReader()) {
                        while (row.Read())
                        {
                            CompStrings comparisonStrings = new CompStrings(row.GetSqlString(0), row.GetSqlString(1));
                            StringDist  dists             = new StringDist(comparisonStrings.from, comparisonStrings.to);
                            returnValues.Add(new AllDistanceMetrics(comparisonStrings.from, comparisonStrings.to,
                                                                    dists.hamming(), dists.jaccard(), dists.jaro(), dists.jaroWinkler(),
                                                                    dists.levenshtein(), dists.levenshteinLower(), dists.levenshteinUpper(),
                                                                    dists.levenshteinNormalized(), dists.overlap(), dists.ratcliff(), dists.sorensenIndex(),
                                                                    dists.sorensenDistance(), dists.tanimotoCoefficient()));
                        }
                    }
                }
            }
            return(returnValues);
        }
 public static SqlDouble jaroWinkler(SqlString string1, SqlString string2)
 {
     var compString = new CompStrings(string1, string2);
     var sdist = new StringDist(compString.from, compString.to);
     return new SqlDouble(sdist.jaroWinkler());
 }
 public static SqlString longestSubSequence(SqlString string1, SqlString string2)
 {
     var compString = new CompStrings(string1, string2);
     var sdist = new StringDist(compString.from, compString.to);
     return new SqlString(sdist.longestSubSequence());
 }
 public static SqlBoolean approximatelySame(SqlString string1, SqlString string2,
                         SqlString comparisonOptions, SqlString toleranceOptions)
 {
     var compString = new CompStrings(string1, string2,
                                   toleranceOptions, comparisonOptions);
     var sdist = new StringDist(compString.from, compString.to);
     return new SqlBoolean(sdist.approxSame(compString.comp, compString.tolerance));
 }
 public static SqlDouble overlap(SqlString string1, SqlString string2)
 {
     var compString = new CompStrings(string1, string2);
     var sdist = new StringDist(compString.from, compString.to);
     return new SqlDouble(sdist.overlap());
 }
 public static SqlDouble sorensenDistance(SqlString string1, SqlString string2)
 {
     var compString = new CompStrings(string1, string2);
     var sdist = new StringDist(compString.from, compString.to);
     return new SqlDouble(sdist.sorensenDistance());
 }
 public static SqlDouble tanimotoCoefficient(SqlString string1, SqlString string2)
 {
     var compString = new CompStrings(string1, string2);
     var sdist = new StringDist(compString.from, compString.to);
     return new SqlDouble(sdist.tanimotoCoefficient());
 }
 public static SqlDouble levenshteinNormalized(SqlString string1, SqlString string2)
 {
     var compString = new CompStrings(string1, string2);
     var sdist = new StringDist(compString.from, compString.to);
     return new SqlDouble(sdist.levenshteinNormalized());
 }
 public static SqlDouble jaroWinklerPrefix(SqlString string1, SqlString string2, SqlDouble scale)
 {
     var compString = new CompStrings(string1, string2);
     var sdist = new StringDist(compString.from, compString.to);
     return new SqlDouble(sdist.jaroWinklerPrefix((double)scale));
 }