Example #1
0
        public static void BuildReverse(IEnumerable <KeyValuePair <string, string> > zalizniak, string outputFileName)
        {
            using (FileStream ModelsFile = File.Create(outputFileName))
            {
                var dict = new DawgBuilder <string>();

                foreach (var entry in zalizniak)
                {
                    string lemma = entry.Key.ToLowerInvariant();

                    dict.Insert(lemma.Reverse(), entry.Value);
                }

                var dawg = dict.BuildDawg();

                dawg.SaveTo(ModelsFile, (w, payload) => w.Write(payload ?? ""));
            }
        }
Example #2
0
        public static void BuildForward(IEnumerable <KeyValuePair <string, string> > zalizniak, string outputFileName)
        {
            using (FileStream DictSearchFile = File.Create(outputFileName))
            {
                var dict = new DawgBuilder <bool>();

                foreach (var entry in zalizniak)
                {
                    string lemma = entry.Key.ToLowerInvariant();

                    dict.Insert(lemma, true);
                }

                var dawg = dict.BuildDawg();

                dawg.SaveTo(DictSearchFile, (w, payload) => w.Write(payload));
            }
        }