當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。