generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 617
[DOC] Tokenizers - Character group #8350
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
Merged
kolchfa-aws
merged 21 commits into
opensearch-project:main
from
leanneeliatra:tokenizer-
Jan 2, 2025
Merged
Changes from 11 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
1fd9a7e
finished tokenizers example
leanneeliatra 0a849c8
updating nav order
leanneeliatra 2a7b8d1
Merge branch 'main' into tokenizer-
leanneeliatra 87ddc07
Merge branch 'main' into tokenizer-
leanneeliatra c99229c
Merge branch 'main' into tokenizer-
leanneeliatra ecb5e5f
layout cleanup
leanneeliatra 828e7fc
grammar fix
leanneeliatra 540c6d7
Merge branch 'main' into tokenizer-
leanneeliatra def3c62
doc: small update for page numbers
leanneeliatra cef551a
layout fix: correct scentence case for all examples
leanneeliatra d4c1cc4
small update: adding copy tag for json segment
leanneeliatra b20028f
Update _analyzers/tokenizers/character-group-tokenizer.md
vagimeli 9a8d21f
Update _analyzers/tokenizers/character-group-tokenizer.md
vagimeli 563ae6b
Update _analyzers/tokenizers/character-group-tokenizer.md
vagimeli 134b05f
Merge branch 'main' into tokenizer-
vagimeli 0eca713
Apply suggestions from code review
leanneeliatra 21af568
Merge branch 'main' into tokenizer-
vagimeli 4af10ef
Doc review
kolchfa-aws f5f0639
Reorder index
kolchfa-aws 52eaad8
Add escape characters
kolchfa-aws 4a98c45
Merge branch 'main' into tokenizer-
kolchfa-aws 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 hidden or 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,42 @@ | ||
--- | ||
layout: default | ||
title: Character Group Tokenizer | ||
parent: Tokenizers | ||
nav_order: 20 | ||
has_children: false | ||
has_toc: false | ||
--- | ||
|
||
# Character group tokenizer | ||
|
||
The character group tokenizer is designed to segment text into tokens based on the presence of specific characters. This tokenizer is ideal for scenarios where a straightforward tokenization approach is required, avoiding the complexity and overhead associated with pattern-based tokenizers. | ||
leanneeliatra marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
The character group tokenizer accepts the following parameters: | ||
vagimeli marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
1. `tokenize_on_chars`: Specifies a set of characters on which the text should be tokenized. When any character from this set is encountered, a new token is created. For example, single characters `(e.g., -, @)` and character classes such as `whitespace`, `letter`, `digit`, `punctuation`, and `symbol`. | ||
leanneeliatra marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
4. `max_token_length`: This parameter defines the maximum length allowed for a token. If a token exceeds this specified length, it will be split at intervals defined by `max_token_length`. The default value is `255`. | ||
vagimeli marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
## Example of the character group tokenizer | ||
leanneeliatra marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
We can tokenize the on characters such as `whitespace`, `-` and `:`. | ||
leanneeliatra marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
```json | ||
POST _analyze | ||
{ | ||
"tokenizer": { | ||
"type": "char_group", | ||
"tokenize_on_chars": [ | ||
"whitespace", | ||
"-", | ||
":" | ||
] | ||
}, | ||
"text": "Fast-cars: drive fast!" | ||
} | ||
``` | ||
{% include copy-curl.html %} | ||
|
||
By analyzing the text "Fast-cars: drive fast!", we can see the specified characters have been removed: | ||
leanneeliatra marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
``` | ||
Fast cars drive fast | ||
|
||
``` |
This file contains hidden or 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
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.
Uh oh!
There was an error while loading. Please reload this page.