Skip to content

Instantly share code, notes, and snippets.

@shubham0204
Created May 19, 2019 13:01
Show Gist options
  • Save shubham0204/b03962b9f2a46f77ee5ac2a4d9a16046 to your computer and use it in GitHub Desktop.
Save shubham0204/b03962b9f2a46f77ee5ac2a4d9a16046 to your computer and use it in GitHub Desktop.
fun classifyText( text : String ) : Int {
val class_1_probability = findProbabilityGivenSample( text , positiveBagOfWords )
val class_2_probability = findProbabilityGivenSample( text , negativeBagOfWords )
if ( class_1_probability > class_2_probability ) {
return CLASS_POSITIVE
}
else if ( class_1_probability < class_2_probability ) {
return CLASS_NEGATIVE
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment