Ejemplo n.º 1
0
 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);
     //    return null;
     //}
     return(UserDefiningPattern.BuildWlString(wl));
 }