Reputation: 689
I would like to make a calendar application that accepts plain english input better than those that exist. I have found Stanford's NLP which seems cool, but I was wondering if it's helpful to this kind of task. I can't find examples of people using it for anything. Should an app actually understand the language? It seems like the natural english calendars that exist are looking for keywords / patterns and trying to parse that way, but I think an app could do better than that.
My real question: Could someone tell me how to find examples of people using the NLP or a different (publicly available) english parser to make a really useful app?
Upvotes: 5
Views: 6342
Reputation: 2097
There are many useful NLP libraries available such as Spacy, NLTK, and CoreNLP
Below are the top 2 NLP libraries which work with NodeJS and Javascript with the examples:
Github: https://github.com/axa-group/nlp.js
NLP.js is developed by the AXA group. It is an NLP library for building bots, with entity extraction, sentiment analysis, automatic language identify, and so more, supports 40 languages.
Here is a basic code snippet to help you understand how easy it is to set it up.
const { NlpManager } = require('node-nlp'); const manager = new NlpManager({ languages: ['en'] });
// Adds the utterances and intents for the NLP manager.addDocument('en', 'goodbye for now', 'greetings.bye'); manager.addDocument('en', 'bye bye take care', 'greetings.bye');
// Train also the NLG manager.addAnswer('en', 'greetings.bye', 'Till next time'); manager.addAnswer('en', 'greetings.bye', 'see you soon!');
// Train and save the model. (async() => { await manager.train(); manager.save(); const response = await manager.process('en', 'I should go now'); console.log(response); })();
Github: https://github.com/NaturalNode/natural
Natural is another famous NLP library for Node.js. “Natural” is a general natural language facility for Node.js. It currently supports tokenizing, stemming, classification, phonetics, tf-idf, WordNet, string similarity, and some inflections.
var natural = require('natural'); var tokenizer = new natural.WordTokenizer(); console.log(tokenizer.tokenize("your dog has fleas.")); // [ 'your', 'dog', 'has', 'fleas' ]
console.log(natural.HammingDistance("karolin", "kathrin", false)); console.log(natural.HammingDistance("karolin", "kerstin", false)); // If strings differ in length -1 is returned
More libraries and sample code is present here: https://www.kommunicate.io/blog/nlp-libraries-node-javascript/
Upvotes: 2
Reputation: 2574
A couple years on there is significant emergent technology in NLP around NodeJS. See here for more of an overview of the situation: http://www.quora.com/Are-there-any-JavaScript-natural-language-processing-projects
But, here is the example to the +1 question, because I too was looking for the same question... just a few years later.
Working Example of NLP... in JavaScript?
Here was my answer...
Steps 1 - Boilerplate Node Server:
install npm
npm install nodebootstrap
nodebootstrap naturalNode
cd naturalNode && npm install
node app
//This should give you a node bootstrap app running at localhost:3000
For full info on easy Node server setup go here: https://github.com/stonebk/nodeboilerplate
STEP 2 - Include Natural Library:
Head to GitHub Natural Library to check out what it can do...
https://github.com/NaturalNode/natural
Run:
npm install natural
(within your bootstrap server named naturalNode)
STEP 3 - Run an Example:
Include the example code from the link above into the app.js bootstrap file.
var natural = require('natural'),
tokenizer = new natural.WordTokenizer();
console.log(tokenizer.tokenize("your dog has fleas."));
// [ 'your', 'dog', 'has', 'fleas' ]
Now when you run your server you have full access to the natural library, and the ability to extend it with front-end interface.
Let me know if any instruction is missing...
Upvotes: 1
Reputation: 83197
Check out NLTK.
NLTK is a leading platform for building Python programs to work with human language data. It provides easy-to-use interfaces to over 50 corpora and lexical resources such as WordNet, along with a suite of text processing libraries for classification, tokenization, stemming, tagging, parsing, and semantic reasoning.
Example of parsing with NLTK:
>>> import nltk
>>> rd_parser = nltk.RecursiveDescentParser(grammar)
>>> sent = 'Mary saw a dog'.split()
>>> for t in rd_parser.nbest_parse(sent):
... print t
(S (NP Mary) (VP (V saw) (NP (Det a) (N dog))))
NLTK is provided with a great free book, which is available online: http://nltk.googlecode.com/svn/trunk/doc/book/book.html
A nice overview from IBM: http://www.ibm.com/developerworks/linux/library/l-cpnltk/index.html
PS: Another SO question that is similar to yours: Using integers/dates as terminals in NLTK parser
Upvotes: 3
Reputation: 7512
Since you didn't specify any programming language, I would suggest a Java lib called Natty. You could ask its author about real-life applications using his lib, if he knows about any.
Upvotes: 0