This project is a demo on using CoreML framework for sentiment analysis of text.
.mlmodel
was developed from Scikit-learn Pipeline using coremltools python package.
You can also use it in the form of plug and play. It is very simple and real quick.
Steps:
-
Drag and drop
SentimentClassificationService.Swift
andVKSentimentAnalysis.mlmodel
into your project. -
sentimentLabel.text = SentimentClassificationService.instance.prediction(from: "I love CoreML")?.emoji
.
We are done.
If you would like to have a glimpse of the whole code and VKSentimentAnalysis.mlmodel description, you can download the project and run the sample project.
Bonus:
This project covers how to use 3D Touch to implement peek and pop using Custom Presentation Controllers. It also shows how to add a Today Extension to the project.