New Fling: Simple Natural Language Processing for iOS
Summary
Simple Natural Language Processing for iOS provides developers with a convenient framework for integrating Natural Language Processing (NLP) into their iOS Apps. When the developer provides a set of training phrases, Simple NLP will use Naïve Bayes Classification to predict the intent of an unfamiliar phrase and extract parameters such as a person’s name and dates. While numerous cloud based solutions already exist to provide similar functionality, they may have associated cost and privacy concerns. With Simple NLP for iOS, your data won’t be sent to a server or cloud service for prediction. All NLP functionality is constrained to the device and processed natively. We hope that you will find this Fling easy to use and beneficial to your project.
Requirements
- Xcode 9.0 or newer
- CocoaPods 1.2.1 or Newer
Instructions
- In your Podfile, add the line
pod 'NativeNLP', :path => '[path to .podspec]/NativeNLP'
- In your Resources group, create a training file for each Intent that you wish to train, label it with the ‘.train’ file extension. For example search.train, for search phrases
- Within your training file add some example phrases to train on. Use at least 10 phrases for better results.
- Naïve Bayes requires balancing between each Intent. Your defined intents are treated as positive, while default intents are treated as Negative. So, if you have 10 phrases for each positive intent, you will need at least 10 default or negative phrases. These should be phrases that could be extracted from a random source, i.e. Reuters, IMDB, or Twitter.
- Once training files has been populated, you’re ready to use NativeNLP pod.
- In your Podfile, add the line
let nlpEngine = NativeNLP()
- Train your NLP engine
nlpEngine.train(fromFileName: "default", forIntent: "default") nlpEngine.train(fromFileName: "search_nlp", forIntent: "email.check")
- Parse user Natural Language phrases
runParser(inputText: "May the force be with you!") runParser(inputText: "Show me emails from Luke") runParser(inputText: "Show me emails from Rey from last Tuesday") You can download it here