Skip to content

Commit 7a06143

Browse files
author
孙健
committed
version up
1 parent cf8035c commit 7a06143

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<dependency>
3232
<groupId>org.ansj</groupId>
3333
<artifactId>ansj_seg</artifactId>
34-
<version>5.1.1</version>
34+
<version>5.1.2</version>
3535
</dependency>
3636

3737
<dependency>

src/main/java/org/ansj/elasticsearch/action/TransportAnsjAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ private AnsjResponse executeAnalyzer(AnsjRequest request) {
9191
AnsjResponse response = new AnsjResponse();
9292

9393
if (!request.asMap().containsKey("text") || !request.asMap().containsKey("type")) {
94-
return response.put("message", "err args example: /_cat/ansj?text=中国&tokenizer=index_ansj&dic=dic&stop=stop&ambiguity=ambiguity&synonyms=synonyms");
94+
return response.put("message", "err args example: /_cat/ansj?text=中国&type=index_ansj&dic=dic&stop=stop&ambiguity=ambiguity&synonyms=synonyms");
9595
}
9696

9797
Analysis analysis;

src/main/java/org/ansj/elasticsearch/cat/AnalyzerCatAction.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.ansj.elasticsearch.cat;
22

3+
import org.ansj.library.*;
34
import org.elasticsearch.action.admin.indices.analyze.AnalyzeRequest;
45
import org.elasticsearch.action.admin.indices.analyze.AnalyzeResponse;
56
import org.elasticsearch.client.node.NodeClient;
@@ -13,6 +14,10 @@
1314
import org.elasticsearch.rest.action.cat.AbstractCatAction;
1415
import org.nlpcn.commons.lang.util.StringUtil;
1516

17+
import java.util.Arrays;
18+
import java.util.HashSet;
19+
import java.util.Set;
20+
1621
/**
1722
* 分词的cat
1823
* Created by zhangqinghua on 16/2/2.
@@ -89,6 +94,15 @@ protected Table getTableWithHeader(RestRequest restRequest) {
8994
return table;
9095
}
9196

97+
@Override
98+
protected Set<String> responseParams() {
99+
Set<String> responseParams = new HashSet<>(super.responseParams());
100+
responseParams.addAll(Arrays.asList("text", "analyzer", "tokenizer", "type", "key",
101+
"isNameRecognition", "isNumRecognition", "isQuantifierRecognition", "isRealName", "isSkipUserDefine",
102+
CrfLibrary.DEFAULT, DicLibrary.DEFAULT, AmbiguityLibrary.DEFAULT, StopLibrary.DEFAULT, SynonymsLibrary.DEFAULT));
103+
return responseParams;
104+
}
105+
92106
private Table buildTable(final AnalyzeResponse analyzeResponse, final RestRequest request) {
93107
Table t = getTableWithHeader(request);
94108
for (AnalyzeResponse.AnalyzeToken token : analyzeResponse.getTokens()) {

0 commit comments

Comments
 (0)