Skip to content

Commit

Permalink
增加测试用例,发布一版.可能是3.x最后一个relase版本
Browse files Browse the repository at this point in the history
  • Loading branch information
Ansj committed Apr 1, 2016
1 parent 9cdf23d commit c363c31
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/org/ansj/app/summary/TagContent.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public String tagContent(List<Keyword> keyWords, String content) {
beginOffe = sgw.offe + temp.length();
}

if (beginOffe < content.length() - 1) {
if (beginOffe <= content.length() - 1) {
sb.append(content.substring(beginOffe, content.length()));
}

Expand Down
22 changes: 22 additions & 0 deletions src/test/java/org/ansj/test/TagWordTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package org.ansj.test;

import java.util.ArrayList;
import java.util.List;

import org.ansj.app.keyword.Keyword;
import org.ansj.app.summary.TagContent;
import org.junit.Test;

public class TagWordTest {
@Test
public void test(){
TagContent tw = new TagContent("<em>", "</em>");
String content = "abc123中国人";
List<Keyword> keywords = new ArrayList<Keyword>();
keywords.add(new Keyword("中国人民", 1.0));
keywords.add(new Keyword("中国", 1.0));
keywords.add(new Keyword("abc", 1.0));
keywords.add(new Keyword("abc12", 1.0));
System.out.println(tw.tagContent(keywords, content));
}
}

0 comments on commit c363c31

Please sign in to comment.