-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
src/test/resources/rest-api-spec/test/analysis-hanlp/10_basic.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
"Tokenizer": | ||
- do: | ||
indices.analyze: | ||
body: | ||
text: 我购买了道具和服装。 | ||
tokenizer: hanlp | ||
- length: { tokens: 3 } | ||
- match: { tokens.0.token: 购买 } | ||
- match: { tokens.1.token: 道具 } | ||
- match: { tokens.2.token: 服装 } | ||
--- | ||
"Analyzer": | ||
- do: | ||
indices.analyze: | ||
body: | ||
text: 我购买了道具和服装。 | ||
analyzer: hanlp-index | ||
- length: { tokens: 3 } | ||
- match: { tokens.0.token: 购买 } | ||
- match: { tokens.1.token: 道具 } | ||
- match: { tokens.2.token: 服装 } |
30 changes: 30 additions & 0 deletions
30
src/test/resources/rest-api-spec/test/analysis-hanlp/20_search.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
"Index Hanlp content": | ||
- do: | ||
indices.create: | ||
index: test | ||
body: | ||
mappings: | ||
type: | ||
properties: | ||
text: | ||
type: text | ||
analyzer: hanlp | ||
|
||
- do: | ||
index: | ||
index: test | ||
type: type | ||
id: 1 | ||
body: { "text": "我购买了道具和服装" } | ||
- do: | ||
indices.refresh: {} | ||
|
||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
match: | ||
text: 购买 | ||
- match: { hits.total: 1 } |