BigML.Model.LocalModel.termMatches C# (CSharp) Method

termMatches() private method

private termMatches ( string text, string fieldLabel, string term ) : int
text string
fieldLabel string
term string
return int
            private int termMatches(string text, string fieldLabel, string term)
            {
                RegexOptions flags = RegexOptions.IgnoreCase;

                Dictionary<string, string> wordsMatch = _termForms[fieldLabel];
                MatchCollection matches;
                if (wordsMatch.ContainsKey(term))
                {
                    if (_caseSensitive.ContainsKey(fieldLabel))
                    {
                        matches = Regex.Matches(text, term);
                    }
                    else
                    {
                        matches = Regex.Matches(text, term, flags);
                    }
                    return matches.Count;
                }
                return 0;
            }