It’s called compromise. The creator of this library Spencer Kelly describes it as not the cleverest, but I think it’s pretty darn clever.
You can find it on GitHub:
We can do a lot with this tiny library but I am going to go through a very simple example of how you can use this to learn a language and coding within a browser. You can do the same on the server (node.js) if you like. I think doing something like this within a browser is going to help a lot more people and it’s great fun!
Lets do this
<!-- Point to the library --> <script src="https://unpkg.com/compromise@latest/builds/compromise.min.js"></script>
What did she do?
let doc = nlp('She sells seashells by the seashore.'); let sentence = doc.sentences(); predict = sentence.toFutureTense().out('text'); // She will sell seashells by the seashore. console.log(predict); reflect = sentence.toPastTense().out('text'); // She sold seashells by the seashore. console.log(reflect);
// Plural + Future fbStatus = nlp("Dinosaur is back.").nouns(0).toPlural().sentences().toFutureTense().out('text'); // Dinosaurs will be back. console.log(fbStatus); // And a lot more!
So this is just a very small part of what compromise NLP library can do. May be you can create a tool to teach language and code? Or create a cool chat bot of your own.
— Happy coding, happy learning.