当前位置: 首页>>代码示例>>C#>>正文


C# WordLibrary.AddCode方法代码示例

本文整理汇总了C#中Studyzy.IMEWLConverter.Entities.WordLibrary.AddCode方法的典型用法代码示例。如果您正苦于以下问题:C# WordLibrary.AddCode方法的具体用法?C# WordLibrary.AddCode怎么用?C# WordLibrary.AddCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Studyzy.IMEWLConverter.Entities.WordLibrary的用法示例。


在下文中一共展示了WordLibrary.AddCode方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ImportLine

 public WordLibraryList ImportLine(string line)
 {
     string[] c = line.Split(' ');
     var wl = new WordLibrary();
     string code = c[0];
     wl.Word = c[1];
     wl.Count = DefaultRank;
     wl.PinYin = CollectionHelper.ToArray(pyGenerater.GetCodeOfString(wl.Word));
     wl.AddCode(CodeType, code);
     var wll = new WordLibraryList();
     wll.Add(wl);
     return wll;
 }
开发者ID:yongsun,项目名称:imewlconverter,代码行数:13,代码来源:CangjiePlatform.cs

示例2: ImportLine

 public WordLibraryList ImportLine(string line)
 {
     string code = line.Split(' ')[0];
     string word = line.Split(' ')[1];
     var wl = new WordLibrary();
     wl.Word = word;
     wl.Count = DefaultRank;
     wl.AddCode(CodeType.Wubi, code);
     wl.PinYin = CollectionHelper.ToArray(pinyinFactory.GetCodeOfString(word));
     var wll = new WordLibraryList();
     if (wl.PinYin.Length > 0)
     {
         wll.Add(wl);
     }
     return wll;
 }
开发者ID:yongsun,项目名称:imewlconverter,代码行数:16,代码来源:Wubi98.cs

示例3: ImportLine

 //private IWordCodeGenerater pyGenerater = new PinyinGenerater();
 public WordLibraryList ImportLine(string str)
 {
     var list = new WordLibraryList();
     string[] words = str.Split(' ');
     for (int i = 1; i < words.Length; i++)
     {
         string word = words[i];
         var wl = new WordLibrary();
         wl.Word = word;
         wl.Count = DefaultRank;
         wl.AddCode(CodeType, words[0]);
         //wl.PinYin = CollectionHelper.ToArray(pyGenerater.GetCodeOfString(word));
         list.Add(wl);
     }
     return list;
 }
开发者ID:yongsun,项目名称:imewlconverter,代码行数:17,代码来源:Xiaoxiao.cs

示例4: BuildWordLibrary


//.........这里部分代码省略.........
                int index1 = Sort.FindIndex(i => i == newSort[0]); //最小的一个
                if (index1 == 0 && ContainCode) //第一个是拼音
                {
                    wl.PinYinString = strlist[0];
                }
                if (index1 == 1)
                {
                    wl.Word = strlist[0];
                }
                if (index1 == 2 && ContainRank)
                {
                    wl.Count = Convert.ToInt32(strlist[0]);
                }
                if (strlist.Length > 1)
                {
                    int index2 = Sort.FindIndex(i => i == newSort[1]); //中间的一个
                    if (index2 == 0 && ContainCode) //第一个是拼音
                    {
                        wl.PinYinString = strlist[1];
                    }
                    if (index2 == 1)
                    {
                        wl.Word = strlist[1];
                    }
                    if (index2 == 2 && ContainRank)
                    {
                        wl.Count = Convert.ToInt32(strlist[1]);
                    }
                }
                if (strlist.Length > 2)
                {
                    int index2 = Sort.FindIndex(i => i == newSort[2]); //最大的一个
                    if (index2 == 0 && ContainCode) //第一个是拼音
                    {
                        wl.PinYinString = strlist[2];
                    }
                    if (index2 == 1)
                    {
                        wl.Word = strlist[2];
                    }
                    if (index2 == 2 && ContainRank)
                    {
                        wl.Count = Convert.ToInt32(strlist[2]);
                    }
                }

                wl.PinYin = wl.PinYinString.Split(new[] { CodeSplitString }, StringSplitOptions.RemoveEmptyEntries);

            }
            else//不是拼音,那么就抛弃直接加入Unknown Code。
            {
                int index1 = Sort.FindIndex(i => i == newSort[0]); //最小的一个
                if (index1 == 0 && ContainCode) //第一个是Code
                {
                    wl.AddCode(CodeType.Unknown, strlist[0]);
                }
                if (index1 == 1)
                {
                    wl.Word = strlist[0];
                }
                if (index1 == 2 && ContainRank)
                {
                    wl.Count = Convert.ToInt32(strlist[0]);
                }
                if (strlist.Length > 1)
                {
                    int index2 = Sort.FindIndex(i => i == newSort[1]); //中间的一个
                    if (index2 == 0 && ContainCode) //第一个是Code
                    {
                        wl.AddCode(CodeType.Unknown, strlist[1]);
                    }
                    if (index2 == 1)
                    {
                        wl.Word = strlist[1];
                    }
                    if (index2 == 2 && ContainRank)
                    {
                        wl.Count = Convert.ToInt32(strlist[1]);
                    }
                }
                if (strlist.Length > 2)
                {
                    int index2 = Sort.FindIndex(i => i == newSort[2]); //最大的一个
                    if (index2 == 0 && ContainCode) //第一个是拼音
                    {
                        wl.AddCode(CodeType.Unknown, strlist[2]);
                    }
                    if (index2 == 1)
                    {
                        wl.Word = strlist[2];
                    }
                    if (index2 == 2 && ContainRank)
                    {
                        wl.Count = Convert.ToInt32(strlist[2]);
                    }
                }

            }
            return wl;
        }
开发者ID:huoxudong125,项目名称:imewlconverter,代码行数:101,代码来源:ParsePattern.cs

示例5: ImportLine

        public virtual WordLibraryList ImportLine(string line)
        {
            var wlList = new WordLibraryList();
            string[] strs = line.Split(' ');

            for (int i = 1; i < strs.Length; i++)
            {
                string word = strs[i].Replace(",", ""); //把汉字中带有逗号的都去掉逗号
                var list = pinyinFactory.GetCodeOfString(word);
                for (int j = 0; j < list.Count; j++)
                {
                    var wl = new WordLibrary();
                    wl.Word = word;
                    if (IsWubi)
                    {
                        wl.AddCode(CodeType.Wubi, strs[0]);
                    }
                    wl.PinYin = CollectionHelper.ToArray(list);
                    wlList.Add(wl);
                }
            }
            return wlList;
        }
开发者ID:yongsun,项目名称:imewlconverter,代码行数:23,代码来源:Jidian.cs

示例6: ImportLine

        //private IWordCodeGenerater pyGenerater=new PinyinGenerater();
        public WordLibraryList ImportLine(string line)
        {
            string[] lineArray = line.Split('\t');

            string word = lineArray[0];
            string code = lineArray[1];
            var wl = new WordLibrary();
            wl.Word = word;
            wl.Count = Convert.ToInt32(lineArray[2]);
            if (CodeType == CodeType.Pinyin)
            {
                wl.PinYin = code.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries);
            }
            else
            {
                //wl.PinYin = CollectionHelper.ToArray(pyGenerater.GetCodeOfString(wl.Word));
                wl.AddCode(CodeType, code);
            }

            var wll = new WordLibraryList();
            wll.Add(wl);
            return wll;
        }
开发者ID:yongsun,项目名称:imewlconverter,代码行数:24,代码来源:Rime.cs


注:本文中的Studyzy.IMEWLConverter.Entities.WordLibrary.AddCode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。