kamthorn opened a new pull request, #16717:
URL: https://github.com/apache/lucene/pull/16717
### Description
Closes #16716
This PR introduces `ThaiNormalizer`, `ThaiNormalizationFilter`, and
`ThaiNormalizationFilterFactory` to `lucene/analysis/common`, providing
standard orthographic normalization for the Thai language.
#### Key Features:
- **`ThaiNormalizer`**:
- Removes zero-width characters (ZWSP `\u200B`, ZWNJ `\u200C`).
- Replaces double Sara E (`\u0E40\u0E40`) with Sara Ae (`\u0E41`).
- Recomposes decomposed Sara Am (Nikhahit `\u0E4D` + optional tone mark +
Sara Aa `\u0E32`) into canonical Sara Am (`\u0E33`).
- Reorders misplaced tone marks (`\u0E48`-`\u0E4B`) or Thanthakhat
(`\u0E4C`) with above/below vowels (`\u0E31`, `\u0E34`-`\u0E3A`, `\u0E47`) to
standard canonical order.
- Reorders follow vowels (`\u0E32`, `\u0E33`) and trailing tone marks.
- Normalizes Lakkhangyao (`\u0E45`) to Sara Aa (`\u0E32`) unless preceded
by Ru (`\u0E24`) or Lu (`\u0E26`).
- Deduplicates consecutive repeated vowels, tone marks, and diacritics.
- Removes leading dangling non-base marks at token start.
- **`ThaiNormalizationFilter`**:
- `TokenFilter` implementation applying `ThaiNormalizer` with
`KeywordAttribute` support.
- **`ThaiNormalizationFilterFactory`**:
- SPI name: `thaiNormalization`. Registered in
`META-INF/services/org.apache.lucene.analysis.TokenFilterFactory`.
- **`ThaiAnalyzer`**:
- Integrated `ThaiNormalizationFilter` into the default analysis pipeline
(`createComponents` and `normalize`).
- **Tests**:
- Added `TestThaiNormalizer` covering all normalization rules.
- Added `TestThaiNormalizationFilterFactory`.
- Added normalization test cases in `TestThaiAnalyzer`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]