-
-
Save fitomad/5e21fd60e3685f8e6b6851f5b813e3cf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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