Does there exist any package to color words based on grammatical class? (Noun, verb, adjective... etc).

Something like rainbow-mode for grammar instead of colors.


I'm sure you could cobble one together; there has been software that analyses the structure of sentences for decades. I wouldn't set your expectations too high though. Consider the following sentences:

Time flies like an arrow.
Fruit flies like a banana.

Unless the software understands context the way a human would, it will be guessing most of the time.

  • It should be possible to get reasonable results with NLTK, although I didn't test this example - see: nltk.org/api/nltk.tokenize.html / en.wikipedia.org/wiki/WordNet – ideasman42 Jul 9 '20 at 4:33
  • In practice that particular example is well-known, so probably any software which is reasonably up to date will at least have a special case for it. – db48x Jul 9 '20 at 5:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.