Пример #1
0
        public static SqlInt32 stringContains(SqlString functionString, SqlString columnString)
        {
            var compStrings = new CompStrings(functionString, columnString);
            var strcont     = new SQLServerStringContains();

            return(new SqlInt32(SQLServerStringContains.stringContains(compStrings.from, compStrings.to)));
        }
Пример #2
0
        public static SqlString regexReplace(SqlString replaceWith, SqlString functionString, SqlString columnString)
        {
            var compStrings = new CompStrings(functionString, columnString, replaceWith);
            var regex       = new SQLServerRegexReplace(opts, compStrings.from);

            return(new SqlString(regex.regexReplace(compStrings.replace, compStrings.to)));
        }
Пример #3
0
        public static SqlString regexSplit(SqlString functionString, SqlString columnString)
        {
            var compStrings = new CompStrings(functionString, columnString);
            var regex       = new SQLServerRegexSplit(opts, compStrings.from);

            return(new SqlString(regex.regexSplit(compStrings.to)));
        }
Пример #4
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()));
        }
Пример #5
0
        public static SqlInt32 regexMatch(SqlString functionString, SqlString columnString)
        {
            var compStrings = new CompStrings(functionString, columnString);
            var regex       = new SQLServerRegexMatch(opts, compStrings.from);

            return(new SqlInt32(regex.regexMatch(compStrings.to)));
        }
Пример #6
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()));
        }
Пример #7
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()));
        }
Пример #8
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()));
        }
Пример #9
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)));
        }
Пример #10
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()));
        }
Пример #11
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()));
        }
Пример #12
0
        public static SqlString toProper(SqlString columnString)
        {
            var compString = new CompStrings(columnString);
            var prop       = new SQLServerToProper();

            return(new SqlString(SQLServerToProper.toProper(compString.col.ToLower())));
        } // End of Method declaration
Пример #13
0
        public static SqlString stringReplace(SqlString replaceWith, SqlString functionString, SqlString columnString)
        {
            var compStrings = new CompStrings(functionString, columnString, replaceWith);
            var strrep      = new SQLServerStringReplace(compStrings.from, compStrings.replace);

            return(new SqlString(strrep.stringReplace(compStrings.to)));
        } // End of Method declaration
Пример #14
0
        public static SqlString indexList(SqlString functionString, SqlString columnString)
        {
            var compStrings = new CompStrings(functionString, columnString);
            var idx         = new SQLServerIndexList();

            return(new SqlString(SQLServerIndexList.indexList(compStrings.from, compStrings.to)));
        } // End of method declaration
        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;
        }
Пример #16
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)));
        }
Пример #17
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 SqlInt32 endIndex(SqlString functionString, SqlString columnString)
 {
     var compStrings = new CompStrings(functionString, columnString);
     var idx = new SQLServerEndIndex();
     return new SqlInt32(SQLServerEndIndex.endIndex(compStrings.from, compStrings.to));
 }
 public static SqlInt32 nullOrEmpty(SqlString columnString)
 {
     var compString = new CompStrings(columnString);
     var sqlnull = new SQLServerNullOrEmpty();
     return new SqlInt32(SQLServerNullOrEmpty.nullOrEmpty(compString.col));
 }
 public static SqlString regexSplit(SqlString functionString, SqlString columnString)
 {
     var compStrings = new CompStrings(functionString, columnString);
     var regex = new SQLServerRegexSplit(opts, compStrings.from);
     return new SqlString(regex.regexSplit(compStrings.to));
 }
 public static SqlInt32 stringContains(SqlString functionString, SqlString columnString)
 {
     var compStrings = new CompStrings(functionString, columnString);
     var strcont = new SQLServerStringContains();
     return new SqlInt32(SQLServerStringContains.stringContains(compStrings.from, compStrings.to));
 }
 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 SqlString regexReplace(SqlString replaceWith, SqlString functionString, SqlString columnString)
 {
     var compStrings = new CompStrings(functionString, columnString, replaceWith);
     var regex = new SQLServerRegexReplace(opts, compStrings.from);
     return new SqlString(regex.regexReplace(compStrings.replace, compStrings.to));
 }
 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 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 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 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 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));
 }
 public static SqlString indexList(SqlString functionString, SqlString columnString)
 {
     var compStrings = new CompStrings(functionString, columnString);
     var idx = new SQLServerIndexList();
     return new SqlString(SQLServerIndexList.indexList(compStrings.from, compStrings.to));
 } // End of method declaration
 public static SqlInt32 regexMatch(SqlString functionString, SqlString columnString)
 {
     var compStrings = new CompStrings(functionString, columnString);
     var regex = new SQLServerRegexMatch(opts, compStrings.from);
     return new SqlInt32(regex.regexMatch(compStrings.to));
 }
 public static SqlString toProper(SqlString columnString)
 {
     var compString = new CompStrings(columnString);
     var prop = new SQLServerToProper();
     return new SqlString(SQLServerToProper.toProper(compString.col.ToLower()));
 } // End of Method declaration
 public static SqlString stringReplace(SqlString replaceWith, SqlString functionString, SqlString columnString)
 {
     var compStrings = new CompStrings(functionString, columnString, replaceWith);
     var strrep = new SQLServerStringReplace(compStrings.from, compStrings.replace);
     return new SqlString(strrep.stringReplace(compStrings.to));
 } // End of Method declaration