diff options
author | Patrick Simianer <simianer@cl.uni-heidelberg.de> | 2014-02-12 17:44:06 +0100 |
---|---|---|
committer | Patrick Simianer <simianer@cl.uni-heidelberg.de> | 2014-02-12 17:44:06 +0100 |
commit | 27bc315543a4e3002e5d4ec0e37be3dcc2e3114e (patch) | |
tree | 8887ee8b5ce2bf6f6fc2c885aafef7340a265226 /lib/nlp_ruby/stringutil.rb | |
parent | f69ba1155e5f51dce0669bcf3e79a4c230e120d2 (diff) |
per sentence bleu, spawn with timeout
Diffstat (limited to 'lib/nlp_ruby/stringutil.rb')
-rw-r--r-- | lib/nlp_ruby/stringutil.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/nlp_ruby/stringutil.rb b/lib/nlp_ruby/stringutil.rb index 4091994..d7381bb 100644 --- a/lib/nlp_ruby/stringutil.rb +++ b/lib/nlp_ruby/stringutil.rb @@ -48,3 +48,8 @@ def read_cfg fn return cfg end +def bag_of_words s, stopwords=[] + s.strip.split.uniq.sort.reject{ |w| stopwords.include? w } +end + + |