Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#2 引入一个新的问题 #4

Closed
kzjeef opened this issue Jun 22, 2014 · 4 comments
Closed

#2 引入一个新的问题 #4

kzjeef opened this issue Jun 22, 2014 · 4 comments

Comments

@kzjeef
Copy link
Contributor

kzjeef commented Jun 22, 2014

#2 带来一个新的问题, 使用说明里面的字典, 如果在Spec加入这个case, 会失败。

it 'should check this word' do
  HarmoniousDictionary.harmonious_words('代开普通发票是什么').should == ['代开普通发票']
   end

原因是因为 rseg.rb 的第87行 word = '' if engine.class == English && !@english_dictionary.include?(word) , 第一个engine把word覆盖成“代开普通发票”, 第二个又把结果覆盖成""

等到了下面check no match的时候, 就已经找不到这个词了。

revert掉这个patch就可以pass这个case

因为两个engine的结果应该是有可能互相覆盖的, 所以最好nomatch 和 word的结果应该用存在一个dict里面, 各保持各得。

但是我做了这个改动以后发现会一直循环在最后一个“非”不和谐词里面, 比如
it 'should find harmonious chinese words' do
HarmoniousDictionary.clean?('李XX在中国').should == false
end
这个case就是会一直在“在” 那里循环。。。

@kzjeef
Copy link
Contributor Author

kzjeef commented Jun 22, 2014

这个就是那个case: kzjeef@8f7e1b0

@wear
Copy link
Owner

wear commented Jun 23, 2014

嗯,我有时间查查!

@wear
Copy link
Owner

wear commented Jun 25, 2014

我在想把 #2 的ci revert, 你觉的呢?

@kzjeef
Copy link
Contributor Author

kzjeef commented Jun 26, 2014

恩。 我也觉得。

这个问题应该比中英文混合要严重一些。

至于算法那部分可能还需要改善一下。。 我自己稍微试验了几下, 结果就死循环了。 后来没怎么看。

@wear wear closed this as completed Jul 6, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants