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


C# Entities.WordLibrary类代码示例

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


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

示例1: ImportLine

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

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

示例2: GetCodeOfWordLibrary

        public override void GetCodeOfWordLibrary(WordLibrary wl)
        {
            if (wl.CodeType == CodeType.TerraPinyin)
            {
                return;
            }
            if (wl.CodeType == CodeType.Pinyin) //如果本来就是拼音输入法导入的,那么就用其拼音,不过得加上音调
            {

                for (int i = 0; i < wl.Codes.Count; i++)
                {
                    var row = wl.Codes[i];
                    for (int j = 0; j < row.Count; j++)
                    {
                        string s = row[j];
                        string py =PinyinHelper.AddToneToPinyin(wl.Word[i], s); //add tone
                        wl.Codes[i][j] = py;
                    }
                }

               
                return ;
            }
            base.GetCodeOfWordLibrary(wl);
        }
开发者ID:XXpanda,项目名称:imewlconverter,代码行数:25,代码来源:TerraPinyinGenerater.cs

示例3: ChinesePunctuationFilterTest

 public void ChinesePunctuationFilterTest(string word, bool isKeep)
 {
     var wl = new WordLibrary();
     wl.Word = word;
     ChinesePunctuationFilter filter = new ChinesePunctuationFilter();
     Assert.AreEqual(filter.IsKeep(wl), isKeep);
 }
开发者ID:XXpanda,项目名称:imewlconverter,代码行数:7,代码来源:AllFilterTest.cs

示例4: GetCodeOfWordLibrary

 public override void GetCodeOfWordLibrary(WordLibrary wl)
 {
     if (wl.CodeType == CodeType.Pinyin)
     {
         return;
     }
     if (wl.CodeType == CodeType.TerraPinyin) //要去掉音调
     {
         for (int i = 0; i < wl.Codes.Count; i++)
         {
             var row = wl.Codes[i];
             for (int j = 0; j < row.Count; j++)
             {
                 string s = row[j];
                 string py = s.Remove(s.Length - 1); //remove tone
                 wl.Codes[i][j] = py;
             }
         }
         return;
     }
     //不是拼音,就调用GetCode生成拼音
     var code= GetCodeOfString(wl.Word);
     wl.Codes = code;
     wl.CodeType=CodeType.Pinyin;
 }
开发者ID:XXpanda,项目名称:imewlconverter,代码行数:25,代码来源:PinyinGenerater.cs

示例5: SpaceFilterTest

 public void SpaceFilterTest(string word,bool isKeep)
 {
     var wl = new WordLibrary();
     wl.Word = word;
     SpaceFilter filter=new SpaceFilter();
     Assert.AreEqual(filter.IsKeep(wl), isKeep);
 }
开发者ID:XXpanda,项目名称:imewlconverter,代码行数:7,代码来源:AllFilterTest.cs

示例6: ExportLine

 public string ExportLine(WordLibrary wl)
 {
     if (string.IsNullOrEmpty(UserDefiningPattern.MappingTablePath))
     {
         if (wl.CodeType != CodeType.Pinyin)
         {
             throw new Exception("未指定字符编码映射文件,无法对词库进行自定义编码的生成");
         }
         else if (wl.Codes.Count == 0 || wl.Codes[0].Count == 0)
         {//是拼音,但是没有给出拼音
             throw new Exception("未指定字符编码映射文件,无法对词库进行自定义编码的生成");
         }
         //自定义拼音格式
         IDictionary<char,string> dic=new Dictionary<char, string>();
         for (var i=0;i< wl.Word.Length;i++)
         {
             if(!dic.ContainsKey(wl.Word[i]))
             dic.Add(wl.Word[i],wl.PinYin[i]);
         }
         return UserDefiningPattern.BuildWLString(dic,wl.Count);
     }
     else//自定义编码模式
     {
         var codes = codeGenerater.GetCodeOfString(wl.Word);
         return UserDefiningPattern.BuildWLString(wl.Word, codes[0], wl.Count);
     }
 }
开发者ID:huoxudong125,项目名称:imewlconverter,代码行数:27,代码来源:SelfDefining.cs

示例7: ExportLine

 public string ExportLine(WordLibrary wl)
 {
     var sb = new StringBuilder();
     sb.Append(wl.SingleCode);
     sb.Append(" ");
     sb.Append(wl.Word);
     return sb.ToString();
 }
开发者ID:starkingpku,项目名称:imewlconverter,代码行数:8,代码来源:XiaoxiaoErbi.cs

示例8: GetCodeOfWordLibrary

 public IList<string> GetCodeOfWordLibrary(WordLibrary str, string charCodeSplit = "")
 {
     if (str.CodeType == CodeType.Pinyin)
     {
         return new List<string> {str.GetPinYinString("", BuildType.None)};
     }
     return CollectionHelper.Descartes(str.Codes);
 }
开发者ID:wadexiao,项目名称:imewlconverter,代码行数:8,代码来源:PhraseGenerater.cs

示例9: ExportLine

        public string ExportLine(WordLibrary wl)
        {
            //StringBuilder sb = new StringBuilder();

            string str = wl.GetPinYinString("'", BuildType.LeftContain) + " " + wl.Word;

            return str;
        }
开发者ID:studyzy,项目名称:imewlconverter,代码行数:8,代码来源:SougouPinyin.cs

示例10: ExportLine

        public string ExportLine(WordLibrary wl)
        {
            var sb = new StringBuilder();

            sb.Append(wl.GetPinYinString("'", BuildType.None));
            sb.Append("\t");
            sb.Append(wl.Word);
            return sb.ToString();
        }
开发者ID:studyzy,项目名称:imewlconverter,代码行数:9,代码来源:SinaPinyin.cs

示例11: GetCodeOfWordLibrary

        public IList<string> GetCodeOfWordLibrary(WordLibrary wl, string charCodeSplit = "")
        {
            if (wl.CodeType == CodeType.Pinyin && IsPinyinCode)
            {
                return CollectionHelper.DescarteIndex1(wl.Codes);
            }

            return GetCodeOfString(wl.Word, charCodeSplit);
        }
开发者ID:hahadalin,项目名称:imewlconverter,代码行数:9,代码来源:SelfDefiningCodeGenerater.cs

示例12: ParsePattern

 public ParsePattern()
 {
     Sort = new List<int> { 1, 2, 3 };
     sample = new WordLibrary();
     sample.Count = 1234;
     sample.Word = "深蓝词库转换";
     sample.PinYin = new[] { "shen", "lan", "ci", "ku", "zhuan", "huan" };
     IsPinyinFormat = true;
 }
开发者ID:kansifang,项目名称:imewlconverter,代码行数:9,代码来源:ParsePattern.cs

示例13: ExportLine

        public override string ExportLine(WordLibrary wl)
        {
            var sb = new StringBuilder();
            sb.Append(factory.GetCodeOfString(wl.Word)[0]);
            sb.Append(" ");
            sb.Append(wl.Word);

            return sb.ToString();
        }
开发者ID:yongsun,项目名称:imewlconverter,代码行数:9,代码来源:JidianZhengma.cs

示例14: GetCodeOfWordLibrary

 public override void GetCodeOfWordLibrary(WordLibrary wl)
 {
     if (wl.CodeType == CodeType.Pinyin)
     {
         wl.SetCode(CodeType.UserDefinePhrase,wl.GetPinYinString("", BuildType.None));
     }
     var codes= CollectionHelper.Descartes(wl.Codes);
     wl.SetCode(CodeType.UserDefinePhrase, codes[0]);
 }
开发者ID:XXpanda,项目名称:imewlconverter,代码行数:9,代码来源:PhraseGenerater.cs

示例15: TestPinyin2TerraPinyin

 public void TestPinyin2TerraPinyin()
 {
     WordLibrary wl=new WordLibrary(){Word = "深蓝",Rank = 123,PinYin = new []{"shen","lan"},CodeType = CodeType.Pinyin};
      generater.GetCodeOfWordLibrary(wl);
     foreach (var py in wl.Codes)
     {
         Debug.WriteLine(py);
     }
   
 }
开发者ID:XXpanda,项目名称:imewlconverter,代码行数:10,代码来源:TerraPinyinTest.cs


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