nori analyzer issue with trailing space [LUCENE-8532]
- Dominant language
- Java
- Stars
- 3.6k
- Forks
- 1.4k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 88
Description
We can reproduce it from Elasticsearch.
When we run the following command:
`GET _analyze`
{
"analyzer": "nori",
"text": "공단시"
``}
It returns the following as expected:
{
"tokens": [
{ "token": "공단", "start_offset": 0, "end_offset": 2, "type": "word", "position": 0 }
,
{ "token": "시", "start_offset": 2, "end_offset": 3, "type": "word", "position": 1 }
]
}
But if we run with "공단시 " (with a trailing space)
GET _analyze
{ "analyzer": "nori", "text": "공단시 " }
It returns
{
"tokens": [
{ "token": "공단", "start_offset": 0, "end_offset": 2, "type": "word", "position": 0 }
,
{ **"token": "씨",** "start_offset": 2, "end_offset": 3, "type": "word", "position": 1 }
]
}
The second token should be "시" instead of "씨".
---
Migrated from [LUCENE-8532](https://issues.apache.org/jira/browse/LUCENE-8532) by Kiju Kim (@kiju98)
Environment:
```
Elasticsearch version: Version: Version: 6.4.2, Build: default/tar/04711c2/2018-09-26T13:34:09.098244Z, JVM: 1.8.0_131
Plugins installed: [analysis-nori]
JVM version:
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
OS version: Darwin Kijuui-MacBook-Pro.local 17.7.0 Darwin Kernel Version 17.7.0: Thu Jun 21 22:53:14 PDT 2018; root:xnu-4570.71.2~1/RELEASE_X86_64 x86_64
```
Attachments: [LUCENE-8532.patch](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-8532/LUCENE-8532.patch)
Contributor guide
Research direction
Reproduce the issue with the Elasticsearch _analyze command using the nori analyzer, comparing input with and without the trailing space. Review the attached LUCENE-8532.patch and the analyzer behavior involved in tokenizing the final syllable. Done means the trailing-space input produces the token "시" rather than "씨" while preserving the existing token offsets.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- search
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100