diff options
Diffstat (limited to 'lib/nlp_ruby/misc.rb')
-rw-r--r-- | lib/nlp_ruby/misc.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/nlp_ruby/misc.rb b/lib/nlp_ruby/misc.rb index 1fa3878..80d932c 100644 --- a/lib/nlp_ruby/misc.rb +++ b/lib/nlp_ruby/misc.rb @@ -11,6 +11,14 @@ class Array } return true end + + def sum + self.inject(:+) + end + + def mean + self.sum.to_f/self.size + end end def spawn_with_timeout cmd, t=4, debug=false |