Inflectors
Nouns
Nouns can be pluralized/singularized with a NounInflector
:
var natural = require('natural');
var nounInflector = new natural.NounInflector();
To pluralize a word (outputs “radii”):
console.log(nounInflector.pluralize('radius'));
To singularize a word (outputs “beer”):
console.log(nounInflector.singularize('beers'));
Numbers
Numbers can be counted with a CountInflector:
var countInflector = natural.CountInflector;
Outputs “1st”:
console.log(countInflector.nth(1));
Outputs “111th”:
console.log(countInflector.nth(111));
Present Tense Verbs
Present Tense Verbs can be pluralized/singularized with a PresentVerbInflector. This feature is still experimental as of 0.0.42, so use with caution, and please provide feedback.
var verbInflector = new natural.PresentVerbInflector();
Outputs “becomes”:
console.log(verbInflector.singularize('become'));
Outputs “become”:
console.log(verbInflector.pluralize('becomes'));