如何为#修复“未定义的方法长度”

时间:2012-12-03 17:38:37

标签: ruby

我安装了这个gem - https://github.com/pluskid/rmmseg-cpp

(文件:http://rmmseg-cpp.rubyforge.org/

当我尝试运行此示例命令时:$echo "我们都喜欢用 Ruby" | rmmseg

我明白了:

/Users/webmagnets/.rvm/gems/ruby-1.9.3-p327@blt/gems/rmmseg-0.1.6/lib/rmmseg/algorithm.rb:24:in `next_token': undefined method `length' for #<Enumerator: "我们都喜欢用 Ruby\n":each_char> (NoMethodError)
    from /Users/webmagnets/.rvm/gems/ruby-1.9.3-p327@blt/gems/rmmseg-0.1.6/lib/rmmseg/algorithm.rb:44:in `segment'
    from /Users/webmagnets/.rvm/gems/ruby-1.9.3-p327@blt/gems/rmmseg-0.1.6/lib/rmmseg.rb:12:in `segment'
    from /Users/webmagnets/.rvm/gems/ruby-1.9.3-p327@blt/gems/rmmseg-0.1.6/bin/rmmseg:65:in `<top (required)>'
    from /Users/webmagnets/.rvm/gems/ruby-1.9.3-p327@blt/bin/rmmseg:23:in `load'
    from /Users/webmagnets/.rvm/gems/ruby-1.9.3-p327@blt/bin/rmmseg:23:in `<main>'

1 个答案:

答案 0 :(得分:0)

我明白了。我使用的是rmmseg而不是rmmseg-cpp。