【发布时间】:2015-09-04 23:09:48
【问题描述】:
我有一个停止词的字符串数组和输入文本的字符串数组,即
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[]
然后从input_Texts数组的索引0文本中删除所有stopWords后,必须对input_Texts数组中的所有文本重复此操作。
任何有修改的建议和代码示例将不胜感激。
谢谢。
【问题讨论】:
标签: c# arrays stop-words removeall word-boundaries