private void BatchInsert(String fileName, String encoder) { String content = PanGu.Framework.File.ReadFileToString(fileName, Encoding.GetEncoding(encoder)); String[] words = PanGu.Framework.Regex.Split(content, @"\r\n"); bool allUse = false; WordAttribute lstWord = null; foreach (String word in words) { if (word == null) { continue; } if (word.Trim() == "") { continue; } string[] strs = word.Split(new char[] { '|' }); if (strs.Length == 3) { try { POS pos = (POS)int.Parse(strs[1].Substring(2, strs[1].Length - 2), System.Globalization.NumberStyles.HexNumber); double frequency = double.Parse(strs[2]); string w = strs[0].Trim(); _WordDict.InsertWord(w, frequency, pos); continue; } catch { } } FormBatchInsert frmBatchInsert = new FormBatchInsert(); if (!allUse || lstWord == null) { frmBatchInsert.Word.Word = word.Trim(); if (frmBatchInsert.ShowDialog() == DialogResult.OK) { lstWord = frmBatchInsert.Word; allUse = frmBatchInsert.AllUse; _WordDict.InsertWord(lstWord.Word, lstWord.Frequency, lstWord.Pos); } } else { lstWord.Word = word.Trim(); _WordDict.InsertWord(lstWord.Word, lstWord.Frequency, lstWord.Pos); } } }
private void BatchInsert(String fileName, String encoder) { String content = PanGu.Framework.File.ReadFileToString(fileName, Encoding.GetEncoding(encoder)); String[] words = PanGu.Framework.Regex.Split(content, @"\r\n"); bool allUse = false; WordAttribute lstWord = null; foreach (String word in words) { if (word == null) { continue; } if (word.Trim() == "") { continue; } FormBatchInsert frmBatchInsert = new FormBatchInsert(); if (!allUse || lstWord == null) { frmBatchInsert.Word.Word = word.Trim(); if (frmBatchInsert.ShowDialog() == DialogResult.OK) { lstWord = frmBatchInsert.Word; allUse = frmBatchInsert.AllUse; _WordDict.InsertWord(lstWord.Word, lstWord.Frequency, lstWord.Pos); } } else { lstWord.Word = word.Trim(); _WordDict.InsertWord(lstWord.Word, lstWord.Frequency, lstWord.Pos); } } }
private void BatchInsert(String fileName, String encoder) { String content = CFile.ReadFileToString(fileName, encoder); String[] words = CRegex.Split(content, @"\r\n"); bool allUse = false; T_DictStruct lstWord = null; foreach (String word in words) { if (word == null) { continue; } if (word.Trim() == "") { continue; } FormBatchInsert frmBatchInsert = new FormBatchInsert(); if (!allUse || lstWord == null) { frmBatchInsert.Word.Word = word.Trim(); if (frmBatchInsert.ShowDialog() == DialogResult.OK) { lstWord = frmBatchInsert.Word; allUse = frmBatchInsert.AllUse; m_DictManage.InsertWord(lstWord.Word, lstWord.Frequency, lstWord.Pos); } } else { lstWord.Word = word.Trim(); m_DictManage.InsertWord(lstWord.Word, lstWord.Frequency, lstWord.Pos); } } }
private void BatchInsert(String fileName, String encoder) { String content = PanGu.Framework.File.ReadFileToString(fileName, Encoding.GetEncoding(encoder)); String[] words = PanGu.Framework.Regex.Split(content, @"\r\n"); bool allUse = false; WordAttribute lstWord = null; foreach (String word in words) { if (word == null) { continue; } if (word.Trim() == "") { continue; } string[] strs = word.Split(new char[] { '|' }); if (strs.Length == 3) { try { POS pos = (POS)int.Parse(strs[1].Substring(2, strs[1].Length - 2), System.Globalization.NumberStyles.HexNumber); double frequency = double.Parse(strs[2]); string w = strs[0].Trim(); _WordDict.InsertWord(w, frequency, pos); continue; } catch { } } FormBatchInsert frmBatchInsert = new FormBatchInsert(); if (!allUse || lstWord == null) { frmBatchInsert.Word.Word = word.Trim(); if (frmBatchInsert.ShowDialog() == DialogResult.OK) { lstWord = frmBatchInsert.Word; allUse = frmBatchInsert.AllUse; _WordDict.InsertWord(lstWord.Word, lstWord.Frequency, lstWord.Pos); } } else { lstWord.Word = word.Trim(); _WordDict.InsertWord(lstWord.Word, lstWord.Frequency, lstWord.Pos); } } }
private void BatchInsert(String fileName, String encoder) { String content = PanGu.Framework.File.ReadFileToString(fileName, Encoding.GetEncoding(encoder)); String[] words = PanGu.Framework.Regex.Split(content, @"\r\n"); bool allUse = false; WordAttribute lstWord = null; foreach (String word in words) { if (word == null) { continue; } if (word.Trim() == "") { continue; } FormBatchInsert frmBatchInsert = new FormBatchInsert(); if (!allUse || lstWord == null) { frmBatchInsert.Word.Word = word.Trim(); if (frmBatchInsert.ShowDialog() == DialogResult.OK) { lstWord = frmBatchInsert.Word; allUse = frmBatchInsert.AllUse; _WordDict.InsertWord(lstWord.Word, lstWord.Frequency, lstWord.Pos); } } else { lstWord.Word = word.Trim(); _WordDict.InsertWord(lstWord.Word, lstWord.Frequency, lstWord.Pos); } } }