我有一个停止词的字符串数组和输入文本的字符串数组,即
string[] stopWords = File.ReadAllLines(@"C:\stopWords.txt");
和
con.Open();
SqlCommand query = con.CreateCommand();
query.CommandText = "select p_abstract from aminer_paper where pid between 1 and 500 and DATALENGTH(p_abstract) != 0";
SqlDataReader reader = query.ExecuteReader();
var summary = new List<string>();
while(reader.Read())
{
summary.Add(reader["p_abstract"].ToString());
}
reader.Close();
string[] input_Texts = summary.ToArray();
现在,我必须使用这些 stopWords 数组从 input_Texts 数组中删除。我使用了以下技术但没有工作,在访问两个数组索引时很奇怪。例如,在 input_Texts 数组的索引 0 处获取第一个文本,即
input_Texts[0]
然后匹配 stopWords 数组中的所有单词字符串,即
// have to match all the indexes of stopWords[] with input_Texts[0]
stopWords[]
然后stopWords
从数组的索引 0 中删除所有文本后input_Texts
,必须对 input_Texts 数组中的所有文本重复此操作。
任何有修改的建议和代码示例将不胜感激。
谢谢。