S
shapper
Hello,
I am trying to get all the words in a phrase and then filter the ones
which are longer then 3 characters.
Basically, I am trying to get words from a phrase that contain some
meaning.
My selecting only the ones longer then three characters I ignore
"and", "so", "or", etc.
Of course this is a rough approximation but ...
I came up with the following:
char[] delimiters = new char[] { ' ', '.', ',', ';', '!', '?',
'-' };
string[] wordlist = phrase.Split(delimiters,
StringSplitOptions.RemoveEmptyEntries);
// Filter words
string[] wordBiggerThen3List = wordlist.Where(w => w.Length >
3).ToArray();
Those are the delimiters that I came up with.
Any suggestion to improve my code?
The filter words part is not really the problem.
The problem is to have the best possible way to get the words with no
punctuation and spaces attached.
Thanks,
Miguel
I am trying to get all the words in a phrase and then filter the ones
which are longer then 3 characters.
Basically, I am trying to get words from a phrase that contain some
meaning.
My selecting only the ones longer then three characters I ignore
"and", "so", "or", etc.
Of course this is a rough approximation but ...
I came up with the following:
char[] delimiters = new char[] { ' ', '.', ',', ';', '!', '?',
'-' };
string[] wordlist = phrase.Split(delimiters,
StringSplitOptions.RemoveEmptyEntries);
// Filter words
string[] wordBiggerThen3List = wordlist.Where(w => w.Length >
3).ToArray();
Those are the delimiters that I came up with.
Any suggestion to improve my code?
The filter words part is not really the problem.
The problem is to have the best possible way to get the words with no
punctuation and spaces attached.
Thanks,
Miguel