Using a CoreML model
Applications can utilize CoreML for many different purposes. One of these purposes is text analysis. You can use a trained model to detect whether a particular piece of text has a positive or negative sentiment. To implement a feature like this, you can use a trained and converted CoreML model.
The code bundle for this chapter includes a project named TextAnalyzer. If you open the start version of this project, you'll find a project that has an implementation of a simple layout along with a button that is hooked up to an @IBAction, named analyze(). The project folder also contains a file called SentimentPolarity.mlmodel. This file is a trained CoreML model that analyzes the sentiment associated with a certain text. Drag ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access