public virtual WordLibraryList ImportText(string str) { //pinyinFactory = new PinyinGenerater(); var wlList = new WordLibraryList(); string[] words = str.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); CountWord = words.Length; CurrentStatus = 0; for (int i = 0; i < words.Length; i++) { try { string word = words[i].Trim(); if (word != string.Empty) { wlList.AddWordLibraryList(ImportLine(word)); } } catch (Exception ex) { Debug.WriteLine(ex.Message); } CurrentStatus++; } return(wlList); }
public WordLibraryList Import(string path) { var pyAndWord = new WordLibraryList(); var fs = new FileStream(path, FileMode.Open, FileAccess.Read); fs.Position = 0x44; CountWord = BinFileHelper.ReadInt32(fs); int segmentCount = BinFileHelper.ReadInt32(fs); //分为几段 CurrentStatus = 0; for (int i = 0; i < segmentCount; i++) { try { fs.Position = 0xC00 + 1024*i; var segment = new Segment(fs); pyAndWord.AddWordLibraryList(segment.WordLibraryList); CurrentStatus += segment.WordLibraryList.Count; } catch (Exception e) { Debug.WriteLine(e.Message); } } return pyAndWord; }
public virtual WordLibraryList ImportText(string str) { //pinyinFactory = new PinyinGenerater(); var wlList = new WordLibraryList(); string[] words = str.Split(new[] {'\r', '\n'}, StringSplitOptions.RemoveEmptyEntries); CountWord = words.Length; CurrentStatus = 0; for (int i = 0; i < words.Length; i++) { try { string word = words[i].Trim(); if (word != string.Empty) { wlList.AddWordLibraryList(ImportLine(word)); } } catch (Exception ex) { Debug.WriteLine(ex.Message); } CurrentStatus++; } return wlList; }
public WordLibraryList ImportText(string str) { var wlList = new WordLibraryList(); string[] lines = str.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); CountWord = lines.Length; for (int i = 0; i < lines.Length; i++) { string line = lines[i]; CurrentStatus = i; if (line.Length > 0 && line[0] != '#')//注释行 { try { wlList.AddWordLibraryList(ImportLine(line)); } catch (Exception ex) { var log = string.Format("[{0}] 不是一个有效的谷歌拼音词库格式,解析时抛出异常:{1}", line, ex.Message); throw new Exception(log); } } } return(wlList); }
//{0x05 2word //4字节使用同一个拼音的词条数x,2字节拼音长度n,n字节拼音的编号,(2字节汉字的长度y,y*2字节汉字的内容Unicode编码,2字节词频,2字节未知,4字节未知)*x #region IWordLibraryImport Members public WordLibraryList Import(string path) { var pyAndWord = new WordLibraryList(); var fs = new FileStream(path, FileMode.Open, FileAccess.Read); fs.Position = 0x44; CountWord = BinFileHelper.ReadInt32(fs); var segmentCount = BinFileHelper.ReadInt32(fs); //分为几段 CurrentStatus = 0; for (int i = 0; i < segmentCount; i++) { try { fs.Position = 0xC00 + 1024 * i; Segment segment = new Segment(fs); pyAndWord.AddWordLibraryList(segment.WordLibraryList); CurrentStatus += segment.WordLibraryList.Count; } catch (Exception e) { Debug.WriteLine(e.Message); } } return(pyAndWord); }
public WordLibraryList ImportText(string str) { var wlList = new WordLibraryList(); string[] lines = str.Split(new[] {'\r','\n'}, StringSplitOptions.RemoveEmptyEntries); CountWord = lines.Length; for (int i = 1; i < lines.Length; i++) { string line = lines[i]; CurrentStatus = i; wlList.AddWordLibraryList(ImportLine(line)); } return wlList; }
public WordLibraryList Import(string path) { var wll = new WordLibraryList(); string txt = ParseQpyd(path); foreach (string line in txt.Split('\n')) { if (line != "") { wll.AddWordLibraryList(ImportLine(line)); } } return wll; }
public WordLibraryList ImportText(string str) { var wlList = new WordLibraryList(); string[] lines = str.Split(new[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries); CountWord = lines.Length; for (int i = 0; i < lines.Length; i++) { string line = lines[i]; CurrentStatus = i; wlList.AddWordLibraryList(ImportLine(line)); } return(wlList); }
public WordLibraryList Import(string path) { var wll = new WordLibraryList(); string txt = ParseQpyd(path); foreach (string line in txt.Split('\n')) { if (line != "") { wll.AddWordLibraryList(ImportLine(line)); } } return(wll); }
public WordLibraryList ImportText(string str) { var wlList = new WordLibraryList(); string[] lines = str.Split(new[] {"\r\n"}, StringSplitOptions.RemoveEmptyEntries); CountWord = lines.Length; for (int i = 0; i < lines.Length; i++) { string line = lines[i]; CurrentStatus = i; if (line.IndexOf("'") == 0) { wlList.AddWordLibraryList(ImportLine(line)); } } return wlList; }
public WordLibraryList ImportText(string str) { var wlList = new WordLibraryList(); string[] lines = str.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); CountWord = lines.Length; for (int i = 0; i < lines.Length; i++) { string line = lines[i]; CurrentStatus = i; if (line.Length > 0 && line[0] != '#')//注释行 { wlList.AddWordLibraryList(ImportLine(line)); } } return(wlList); }
public WordLibraryList ImportText(string text) { var list = new WordLibraryList(); string[] lines = text.Split(new[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries); CountWord = lines.Length; CurrentStatus = 0; foreach (string s in lines) { CurrentStatus++; if (IsContent(s)) { list.AddWordLibraryList(ImportLine(s)); } } return(list); }
public WordLibraryList ImportText(string str) { var wlList = new WordLibraryList(); string[] words = str.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); CountWord = words.Length; for (int i = 0; i < words.Length; i++) { CurrentStatus = i; try { wlList.AddWordLibraryList(ImportLine(words[i])); } catch { } } return(wlList); }
public WordLibraryList ImportText(string str) { var wlList = new WordLibraryList(); string[] lines = str.Split(new[] { "\n" }, StringSplitOptions.RemoveEmptyEntries); CountWord = lines.Length; for (int i = 1; i < lines.Length; i++) { string line = lines[i]; CurrentStatus = i; try { wlList.AddWordLibraryList(ImportLine(line)); } catch { SendImportLineErrorNotice("无效的词条,解析失败:" + line); } } return(wlList); }
public virtual WordLibraryList ImportText(string str) { pinyinFactory = new WordPinyinGenerater(); var wlList = new WordLibraryList(); string[] words = str.Split(new[] {'\r', '\n'}, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < words.Length; i++) { try { string word = words[i].Trim(); if (word != string.Empty) { wlList.AddWordLibraryList(ImportLine(word)); } } catch { } } return wlList; }
public virtual WordLibraryList ImportText(string str) { pinyinFactory = new WordPinyinGenerater(); var wlList = new WordLibraryList(); string[] words = str.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < words.Length; i++) { try { string word = words[i].Trim(); if (word != string.Empty) { wlList.AddWordLibraryList(ImportLine(word)); } } catch { } } return(wlList); }
public WordLibraryList ImportText(string str) { var wlList = new WordLibraryList(); string[] lines = str.Split(new[] {"\r", "\n"}, StringSplitOptions.RemoveEmptyEntries); CountWord = lines.Length; for (int i = 0; i < lines.Length; i++) { string line = lines[i]; CurrentStatus = i; if (line.StartsWith("#")) { continue; } wlList.AddWordLibraryList(ImportLine(line)); } return wlList; }
public WordLibraryList ImportText(string text) { var list = new WordLibraryList(); string[] lines = text.Split(new[] {'\n', '\r'}, StringSplitOptions.RemoveEmptyEntries); CountWord = lines.Length; CurrentStatus = 0; foreach (string s in lines) { CurrentStatus++; if (IsContent(s)) { list.AddWordLibraryList(ImportLine(s)); } } return list; }
public WordLibraryList ImportText(string str) { var wlList = new WordLibraryList(); string[] words = str.Split(new[] {'\r', '\n'}, StringSplitOptions.RemoveEmptyEntries); CountWord = words.Length; for (int i = 0; i < words.Length; i++) { CurrentStatus = i; try { wlList.AddWordLibraryList(ImportLine(words[i])); } catch { } } return wlList; }