Beispiel #1
0
        private WordLibraryList Filter(WordLibraryList list)
        {
            var result = new WordLibraryList();

            foreach (WordLibrary wordLibrary in list)
            {
                if (IsKeep(wordLibrary))
                {
                    if (ReplaceFilters != null)
                    {
                        foreach (IReplaceFilter replaceFilter in ReplaceFilters)
                        {
                            if (!replaceFilter.ReplaceAfterCode)
                            {
                                replaceFilter.Replace(wordLibrary);
                            }
                        }
                    }
                    if (wordLibrary.Word != string.Empty)
                    {
                        result.Add(wordLibrary);
                    }
                }
            }
            return(result);
        }
Beispiel #2
0
        private WordLibraryList RemoveEmptyCodeData(WordLibraryList wordLibraryList)
        {
            var list = new WordLibraryList();

            foreach (WordLibrary wordLibrary in wordLibraryList)
            {
                if (!string.IsNullOrEmpty(wordLibrary.SingleCode))//没有编码,则不保留
                {
                    list.Add(wordLibrary);
                }
            }
            return(list);
        }
Beispiel #3
0
        private WordLibraryList SampleWL()
        {
            var list = new WordLibraryList();

            string[] lines = rtbFrom.Text.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
            foreach (string line in lines)
            {
                list.Add(new WordLibrary {
                    Word = line, Rank = 1234, CodeType = CodeType.NoCode
                });
            }
            return(list);
        }
Beispiel #4
0
        private WordLibraryList Filter(WordLibraryList list)
        {
            WordLibraryList result = new WordLibraryList();

            foreach (WordLibrary wordLibrary in list)
            {
                if (IsKeep(wordLibrary))
                {
                    result.Add(wordLibrary);
                }
            }
            return(result);
        }
Beispiel #5
0
        public WordLibraryList Import(string str)
        {
            WordLibraryList wlList = new WordLibraryList();
            var             lines  = str.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);

            for (int i = 0; i < lines.Length; i++)
            {
                string line = lines[i];
                var    c    = line.Split('\t');

                WordLibrary wl = new WordLibrary();
                wl.Word   = c[0];
                wl.Count  = Convert.ToInt32(c[1]);
                wl.PinYin = c[2].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                wlList.Add(wl);
            }
            return(wlList);
        }