private void openFile_Click(object sender, EventArgs e) { OpenFileDialog ofp = new OpenFileDialog(); string keywords = ""; if (ofp.ShowDialog() == DialogResult.OK) { if (NLPIR.Init(@"F:/Project/Visual Studio 2012/Projects/TextProcess/TextProcess/", 0)) { keywords = NLPIR.GetFileKeyWords(ofp.FileName, 6, false); } string fileName = System.IO.Path.GetFileName(ofp.FileName); filePath.Text = ofp.FileName; //string sql = string.Format("select * from KeyWords"); //DataTable keyWords = DbHelperSQL.Query(sql).Tables[0]; //var dataRows = keyWords.AsEnumerable().Where<DataRow>(C => C["filename"].ToString() == fileName && C["keywords"].ToString() == keywords); //int row = dataRows.Count<DataRow>(); //if (row==1) //{ // MessageBox.Show("该文章记录已存在,您可以从历史记录中查找!"); //} keyword.Text = keywords; } }
private void keyWords_Click(object sender, EventArgs e) { string fileName = ""; string path = ""; String allTxt = ""; int num = 0; if (filePath.Text == "") { MessageBox.Show("请选择文件!"); } else { path = filePath.Text; fileName = System.IO.Path.GetFileName(path); } if (NLPIR.Init(@"F:/Project/Visual Studio 2012/Projects/TextProcess/TextProcess/", 0)) { string keywords = NLPIR.GetFileKeyWords(path, 6, false); keyword.Text = keywords; //string sql = string.Format("insert into KeyWords(filename,keywords) values('{0}','{1}')", fileName, keywords); // num = DbHelperSQL.ExecuteSql(sql); } }