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); }
public string ExportLine(WordLibrary wl) { //StringBuilder sb = new StringBuilder(); string str = wl.GetPinYinString("'", BuildType.LeftContain) + " " + wl.Word; return str; }
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(); }
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]); }
public string ExportLine(WordLibrary wl) { var sb = new StringBuilder(); sb.Append(wl.Word); sb.Append("\t"); if (!wl.IsEnglish) { sb.Append(wl.GetPinYinString("'", BuildType.RightContain)); sb.Append("\t"); } sb.Append(wl.Count); return sb.ToString(); }
public string ExportLine(WordLibrary wl) { var sb = new StringBuilder(); string py = wl.GetPinYinString("'", BuildType.None); sb.Append(py); sb.Append(" "); sb.Append(wl.Word); sb.Append(" "); sb.Append(number); sb.Append(" Z, "); sb.Append(py); sb.Append(" "); sb.Append(number); return sb.ToString(); }
public string ExportLine(WordLibrary wl) { var sb = new StringBuilder(); if (codeGenerater.Is1CharMutiCode) { IList<string> codes = codeGenerater.GetCodeOfString(wl.Word); int i = 0; foreach (string code in codes) { sb.Append(wl.Word); sb.Append("\t"); sb.Append(code); sb.Append("\t"); sb.Append(wl.Count); i++; if (i != codes.Count) sb.Append("\r\n"); } } else { sb.Append(wl.Word); sb.Append("\t"); if (CodeType == CodeType.Pinyin) { sb.Append(wl.GetPinYinString(" ", BuildType.None)); } else if (CodeType == wl.CodeType) { sb.Append(wl.Codes[0][0]); } else { if (codeGenerater.Is1Char1Code) { sb.Append(CollectionHelper.ListToString(codeGenerater.GetCodeOfString(wl.Word), " ")); } else { sb.Append(CollectionHelper.ListToString(codeGenerater.GetCodeOfString(wl.Word))); } } sb.Append("\t"); sb.Append(wl.Count); } return sb.ToString(); }
//private RimeConfigForm form; public string ExportLine(WordLibrary wl) { var sb = new StringBuilder(); if (codeGenerater == null) { codeGenerater = CodeTypeHelper.GetGenerater(CodeType); } codeGenerater.GetCodeOfWordLibrary(wl); if (codeGenerater.Is1CharMutiCode) { IList<string> codes = codeGenerater.GetCodeOfString(wl.Word).ToCodeString(" "); int i = 0; foreach (string code in codes) { sb.Append(wl.Word); sb.Append("\t"); sb.Append(code); sb.Append("\t"); sb.Append(wl.Rank); i++; if (i != codes.Count) sb.Append(lineSplitString); } } else { sb.Append(wl.Word); sb.Append("\t"); if (CodeType == CodeType.Pinyin || CodeType == CodeType.TerraPinyin) { sb.Append(wl.GetPinYinString(" ", BuildType.None)); } else if (CodeType == wl.CodeType) { sb.Append(wl.Codes[0][0]); } else { sb.Append(wl.Codes.ToCodeString(" ")[0]); } sb.Append("\t"); sb.Append(wl.Rank); } return sb.ToString(); }
public string ExportLine(WordLibrary wl) { var sb = new StringBuilder(); if (CodeType == CodeType.Pinyin) { sb.Append(wl.GetPinYinString("", BuildType.None)); } else if (CodeType == wl.CodeType) { sb.Append(wl.Codes); } else { sb.Append(CollectionHelper.ListToString(CodeGenerater.GetCodeOfString(wl.Word))); } sb.Append(" "); sb.Append(wl.Word); return sb.ToString(); }
public string ExportLine(WordLibrary wl) { var sb = new StringBuilder(); sb.Append(wl.Word); sb.Append(" "); try { var py = wl.GetPinYinString("'", BuildType.None); if (string.IsNullOrEmpty(py)) { return ""; } sb.Append(py); } catch (Exception ex) { Debug.WriteLine(ex.Message); } return sb.ToString(); }
public string ExportLine(WordLibrary wl) { var sb = new StringBuilder(); if (CodeType == CodeType.Pinyin) { sb.Append(wl.GetPinYinString("", BuildType.None)); } else if (CodeType == wl.CodeType) { sb.Append(wl.Codes[0][0]); } else { var code= CodeGenerater.GetCodeOfString(wl.Word); sb.Append(code.ToCodeString()); } sb.Append(" "); sb.Append(wl.Word); return sb.ToString(); }
public string ExportLine(WordLibrary wl) { var sb = new StringBuilder(); sb.Append(wl.Word); sb.Append("\t"); //IList<string> zhuyins = null; //if (wl.CodeType == CodeType.Pinyin) //如果本来就是拼音输入法导入的,那么就用其拼音,不过得加上音调 //{ // IList<string> pinyin = new List<string>(); // for (int i = 0; i < wl.PinYin.Length; i++) // { // if (regex.IsMatch(wl.PinYin[i])) // { // pinyin.Add(wl.PinYin[i]); // } // else // { // pinyin.Add(PinyinHelper.AddToneToPinyin(wl.Word[i], wl.PinYin[i])); // } // } // zhuyins = ZhuyinHelper.GetZhuyin(pinyin); //} //else //{ // //zhuyins = generater.GetCodeOfString(wl.Word); //} //sb.Append(CollectionHelper.ListToString(zhuyins, ",")); sb.Append(wl.GetPinYinString(",", BuildType.None)); sb.Append("\t"); sb.Append("-1.0"); sb.Append("\t"); sb.Append("0.0"); return sb.ToString(); }
//没有什么思路,接下来的代码写得乱七八糟的,但是好像还是对的。zengyi20101114 //如果wl中提供了拼音数组,而且自定义格式也是拼音格式,那么就只转换格式即可。 public string BuildWLString(WordLibrary wl) { string py = "", cp = ""; var sb = new StringBuilder(); if (ContainCode) { if (IsPinyinFormat) { py = wl.GetPinYinString(CodeSplitString, CodeSplitType); } else { selfFactory.MutiWordCodeFormat = MutiWordCodeFormat; py = selfFactory.GetCodeOfString(wl.Word)[0]; } } if (ContainRank) { cp = wl.Count.ToString(); } var dic = new Dictionary<int, string>(); dic.Add(Sort[0], py); dic.Add(Sort[1], wl.Word); dic.Add(Sort[2], cp); var newSort = new List<int>(Sort); newSort.Sort(); foreach (int x in newSort) { if (dic[x] != "") { sb.Append(dic[x] + SplitString); } } string str = sb.ToString(); return str.Substring(0, str.LastIndexOf(SplitString)); }