Is there an easy way to go from the IntCounter you get as a result of Counters.count to a normalized counter? The best I could come up with was:
scala> val counts = Counters.count(Seq("a", "b", "a", "c", "b"))
counts: scalala.tensor.counters.Counters.IntCounter[java.lang.String] = Counters((a,2), (b,2), (c,1))
scala> Counters.normalize(Counters.aggregate(for ((k, v) <- counts) yield (k, v.toDouble)))
res9: scalala.tensor.counters.Counters.DoubleCounter[java.lang.String] = Counters((a,0.4), (b,0.4), (c,0.2))
Thanks,
Steve
--
You received this message because you are subscribed to the Google Groups "ScalaNLP" group.
To post to this group, send email to
scal...@googlegroups.com.
To unsubscribe from this group, send email to
scalanlp+u...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/scalanlp?hl=en.