text - stop words removal using c# -
i have 2 string arrays i.e.
string[] text = {"paragraph 1 containing long text of ten 20 lines", "paragraph 2 containing long text of ten 20 lines", "paragraph 3 containing long text of ten 20 lines",.....};
and array of stop words i.e.
string[] stop_words = file.readalllines(@"c:\stopwords.txt");
string[] text
array containing paragraphs of text , string[] stop_words
array consists stop words removed texts stored in string[] text
array
how stop words can removed using c#. code suggestions highly appreciated.
thanks
try this:
string[] result = text.except(stop_words).toarray();
or else can try using loop
string[] stop_word = new string[] { "please", "try", "something" }; string str = "please try before asking"; foreach (string word in stop_word ) { str = str.replace(word, ""); }
Comments
Post a Comment