Instantly share code, notes, and snippets.

Embed
What would you like to do?
import NaturalLanguage
...
/**
Consulta al modelo acerca de la categoría a la
que pertenece la reseña que acaba de escribir el
usuario.
*/
@IBAction private func handlePredictButtoTap(sender: UIButton) -> Void
{
self.labelRating.text = ""
guard let model = try? NLModel(mlModel: SentimentReview().model),
let review = self.textviewReview.text
else
{
return
}
if let rating = model.predictedLabel(for: review), let rate = Rate(rawValue: rating)
{
self.labelRating.text = "(\(rating))\(rate)"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment