-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
[DOCS] Reformat CJK bigram and CJK width token filter docs #48210
Merged
+249
−20
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
85 changes: 78 additions & 7 deletions
85
docs/reference/analysis/tokenfilters/cjk-width-tokenfilter.asciidoc
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 |
---|---|---|
@@ -1,12 +1,83 @@ | ||
[[analysis-cjk-width-tokenfilter]] | ||
=== CJK Width Token Filter | ||
=== CJK width token filter | ||
++++ | ||
<titleabbrev>CJK width</titleabbrev> | ||
++++ | ||
|
||
The `cjk_width` token filter normalizes CJK width differences: | ||
Normalizes width differences in CJK (Chinese, Japanese, and Korean) characters | ||
as follows: | ||
|
||
* Folds fullwidth ASCII variants into the equivalent basic Latin | ||
* Folds halfwidth Katakana variants into the equivalent Kana | ||
* Folds full-width ASCII character variants into the equivalent basic Latin | ||
characters | ||
* Folds half-width Katakana character variants into the equivalent Kana | ||
characters | ||
|
||
NOTE: This token filter can be viewed as a subset of NFKC/NFKD | ||
Unicode normalization. See the {plugins}/analysis-icu-normalization-charfilter.html[`analysis-icu` plugin] | ||
for full normalization support. | ||
This filter is included in {es}'s built-in <<cjk-analyzer,CJK language | ||
analyzer>>. It uses Lucene's | ||
https://lucene.apache.org/core/{lucene_version_path}/analyzers-common/org/apache/lucene/analysis/cjk/CJKWidthFilter.html[CJKWidthFilter]. | ||
|
||
NOTE: This token filter can be viewed as a subset of NFKC/NFKD Unicode | ||
normalization. See the | ||
{plugins}/analysis-icu-normalization-charfilter.html[`analysis-icu` plugin] for | ||
full normalization support. | ||
|
||
[[analysis-cjk-width-tokenfilter-analyze-ex]] | ||
==== Example | ||
|
||
[source,console] | ||
-------------------------------------------------- | ||
GET /_analyze | ||
{ | ||
"tokenizer" : "standard", | ||
"filter" : ["cjk_width"], | ||
"text" : "シーサイドライナー" | ||
} | ||
-------------------------------------------------- | ||
|
||
The filter produces the following token: | ||
|
||
[source,text] | ||
-------------------------------------------------- | ||
シーサイドライナー | ||
-------------------------------------------------- | ||
|
||
///////////////////// | ||
[source,console-result] | ||
-------------------------------------------------- | ||
{ | ||
"tokens" : [ | ||
{ | ||
"token" : "シーサイドライナー", | ||
"start_offset" : 0, | ||
"end_offset" : 10, | ||
"type" : "<KATAKANA>", | ||
"position" : 0 | ||
} | ||
] | ||
} | ||
-------------------------------------------------- | ||
///////////////////// | ||
|
||
[[analysis-cjk-width-tokenfilter-analyzer-ex]] | ||
==== Add to an analyzer | ||
|
||
The following <<indices-create-index,create index API>> request uses the | ||
CJK width token filter to configure a new | ||
<<analysis-custom-analyzer,custom analyzer>>. | ||
|
||
[source,console] | ||
-------------------------------------------------- | ||
PUT /cjk_width_example | ||
{ | ||
"settings" : { | ||
"analysis" : { | ||
"analyzer" : { | ||
"standard_cjk_width" : { | ||
"tokenizer" : "standard", | ||
"filter" : ["cjk_width"] | ||
} | ||
} | ||
} | ||
} | ||
} | ||
-------------------------------------------------- |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strictly speaking, it will form bigrams from the CJK tokens produced by any tokenizer, so I'm not sure we need to refer to standard and icu here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @romseygeek. I removed the standard and ICU reference with cecd9bc.