String Review="The portfolio is fine except for the fact that the last movement of sonata #6 is missing. What should one expect?";
string[] arrStopword = new string[] {"a", "i", "it", "am", "at", "on", "in", "to", "too", "very","of", "from", "here", "even", "the", "but", "and", "is","my","them", "then", "this", "that", "than", "though", "so", "are"};
StringBuilder sbReview = new StringBuilder(Review);
foreach (string word in arrStopword){
sbReview.Replace(word, "");}
Label1.Text = sbReview.ToString();
运行Label1.Text = "The portfolo s fne except for fct tht lst movement st #6 s mssng. Wht should e expect? "
时
我希望它必须返回"portofolio fine except for fact last movement sonata #6 is missing. what should one expect?"
有人知道如何解决这个问题?
我在创建从字符串中删除停用词的代码时遇到麻烦。这是我的代码:String Review =“除了没有奏鸣曲#6的最后动作的事实,组合还不错。...
string
函数将Split
转换为以list
(space)分隔的string
的" "
,然后使用Except
来获取结果将包含的单词,然后可以申请string.Join
RemoveStopWords
方法