/// <summary> /// Adds pattern ending in this node /// </summary> /// <param name="ngram">Pattern</param> public void AddNgram(ngram_t <T> ngram) { if (_Ngrams == null) { _Ngrams = new HashSet <ngram_t <T> >(ngram_t_IEqualityComparer.Inst); } _Ngrams.Add(ngram); }
public static ngram_t <before_no_proper_t> ToBeforeNoProper_ngrams(this XElement xe) { var words = xe.GetWordsArray(); var unstick_from_digits = xe.AttrValueIsTrue("unstick-from-digits"); var ngram = new ngram_t <before_no_proper_t>(words, new before_no_proper_t(unstick_from_digits)); return(ngram); }
public static ngram_t <before_proper_or_number_t> ToBeforeProperOrNumber_ngrams(this XElement xe) { var words = xe.GetWordsArray(); var digits_before = xe.AttrValueIsTrue("digits-before"); var slash_before = xe.AttrValueIsTrue("slash-before"); var unstick_from_digits = xe.AttrValueIsTrue("unstick-from-digits"); var ngram = new ngram_t <before_proper_or_number_t>(words, new before_proper_or_number_t(digits_before, slash_before, unstick_from_digits)); return(ngram); }
public bool Equals(ngram_t <TValue> x, ngram_t <TValue> y) { var len = x.words.Length; if (len != y.words.Length) { return(false); } for (int i = 0; i < len; i++) { if (!string.Equals(x.words[i], y.words[i])) { return(false); } } return(true); }
/// <summary> /// Adds pattern ending in this node /// </summary> /// <param name="ngram">Pattern</param> public void AddNgram(ngram_t <TValue> ngram) { Ngrams.Add(ngram); }
public int GetHashCode(ngram_t <TValue> obj) { return(obj.words.Length.GetHashCode()); }
public int GetHashCode(ngram_t <T> obj) => obj.words.Length;