Permalink
Browse files

修正转换同义词问题

  • Loading branch information...
1 parent a0a4159 commit 6af17c8b1ff9bda65af67ee9cc995bd7685f2809 @leizongmin committed Nov 2, 2015
Showing with 3 additions and 3 deletions.
  1. +1 −1 lib/Segment.js
  2. +2 −2 test/test_segment.js
View
@@ -142,7 +142,7 @@ Segment.prototype.loadSynonymDict = function (name) {
if (blocks.length > 1) {
var n1 = blocks[0].trim();
var n2 = blocks[1].trim();
- TABLE[n2] = n1;
+ TABLE[n1] = n2;
if (TABLE[n2] === n1) {
delete TABLE[n2];
}
@@ -106,8 +106,8 @@ describe('ChsNameTokenizer', function () {
});
it('options: convertSynonym=true', function () {
- assert.equal(segment.doSegment('入眠', {simple: true, convertSynonym: true}).join('\t'),
- ['入眠'].join('\t'));
+ assert.equal(segment.doSegment('何时入睡', {simple: true, convertSynonym: true}).join('\t'),
+ ['什么时候', '入眠'].join('\t'));
});
it('options: stripStopword=true', function () {

0 comments on commit 6af17c8

Please sign in to comment.