Is there a service that recognizes if a certain type of word is a preposition?
I want to make a word ranking of a feeder rss , but ignoring prepositions.
Ignoring words with less than N characters is a good start, but maybe not enough, as there are still a lot of prepositions left. Here are two lists:
Essential prepositions: the ante, after, until, with, against, from, in, between, to, before, through, without, under, behind.
Accidental Prepositions: (= in the quality of), according (= according to), second (= conform), consonant (= conform), during, saved, out, by, tie, except, otherwise, p>
Do you know of any service that does this identification or do you have any idea how to implement a reasonable method, that is, it does not have to be 100% comprehensive, but covers a significant part of the words?
It can be in any language.
Thank you.
Here is a snippet of C # code that I'm using in the prototype, but it has proven to be inefficient:
private static IEnumerable<IGrouping<string, string>> MostCommonWords(string str, int maxNumWords)
{
var prepositions = new string[] {/*...*/};
var mostCommonWords =
Regex.Split(str.ToLower(), @"\W+")
.Where(s => s.Length > 3 && !prepositions.Contains(s))
.GroupBy(s => s)
.OrderByDescending(g => g.Count()).Take(maxNumWords);
return mostCommonWords;
}