Error in line 20: instantiating 'Machine::Bayes::BayesClasifier#classify(String)'
in lib/machine/src/machine/bayes/bayes_classifier.cr:69: instantiating 'classify_with_score(String)'
classify_with_score(text).keys.first
^~~~~~~~~~~~~~~~~~~
in lib/machine/src/machine/bayes/bayes_classifier.cr:65: instantiating 'classifications(String)'
classifications(text).map { |k, v| {k => -v} }.sort_by { |a| a.values[0] }[0]
^~~~~~~~~~~~~~~
in lib/machine/src/machine/bayes/bayes_classifier.cr:51: instantiating 'Hash(String, Machine::Bayes::Category)#each()'
@categories.each do |category_name, category|
^~~~
in lib/machine/src/machine/bayes/bayes_classifier.cr:51: instantiating 'Hash(String, Machine::Bayes::Category)#each()'
@categories.each do |category_name, category|
^~~~
in lib/machine/src/machine/bayes/bayes_classifier.cr:58: undefined method 'key?' for Hash(String, Int32)
s = @category_counts.key?(category_name) ? @category_counts[category_name] : 0.1
^~~~
Rerun with --error-trace to show a complete error trace.
On Crystal
0.25.1
I get this error: