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

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -