Exemplo n.º 1
0
        public WordLibraryList ImportLine(string line)
        {
            string[] c  = line.Split('\t');
            var      wl = new WordLibrary();

            wl.Word  = c[0];
            wl.Count = DefaultRank;
            string zhuyin = c[1];
            var    pys    = new List <string>();

            foreach (string zy in zhuyin.Split(','))
            {
                try
                {
                    string py = ZhuyinHelper.GetPinyin(zy);
                    pys.Add(py);
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex.Message);
                }
            }
            wl.PinYin = pys.ToArray();
            var wll = new WordLibraryList();

            wll.Add(wl);
            return(wll);
        }
Exemplo n.º 2
0
        public override IList <string> GetCodeOfWordLibrary(Entities.WordLibrary wl, string charCodeSplit = "")
        {
            var result = new List <string>();

            foreach (string code in base.GetCodeOfWordLibrary(wl, charCodeSplit))
            {
                result.Add(ZhuyinHelper.GetZhuyin(code));
            }
            return(result);
        }
Exemplo n.º 3
0
        public override IList <string> GetCodeOfString(string str, string charCodeSplit = "")
        {
            var result = new List <string>();

            foreach (string code in base.GetCodeOfString(str, charCodeSplit))
            {
                result.Add(ZhuyinHelper.GetZhuyin(code));
            }
            return(result);
        }
Exemplo n.º 4
0
        public override IList <string> GetCodeOfChar(char str)
        {
            var result = new List <string>();

            foreach (string code in base.GetCodeOfChar(str))
            {
                result.Add(ZhuyinHelper.GetZhuyin(code));
            }
            return(result);
        }
 public override void GetCodeOfWordLibrary(WordLibrary wl)
 {
     base.GetCodeOfWordLibrary(wl);
     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 zy = ZhuyinHelper.GetZhuyin(s);
             wl.Codes[i][j] = zy;
         }
     }
 }
        public override Code GetCodeOfString(string str)
        {
            var result = new List <IList <string> >();

            foreach (var row in base.GetCodeOfString(str))
            {
                var zyrow = new List <string>();
                foreach (var py in row)
                {
                    zyrow.Add(ZhuyinHelper.GetZhuyin(py));
                }

                result.Add(zyrow);
            }
            return(new Code(result));
        }