-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose Unicode normalization methods on Texts (#7425)
Exposes Text_Utils.normalize().
- Loading branch information
1 parent
9e9cf0b
commit 037a687
Showing
6 changed files
with
94 additions
and
0 deletions.
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
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
41 changes: 41 additions & 0 deletions
41
distribution/lib/Standard/Base/0.0.0-dev/src/Data/Text/Normalization.enso
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,41 @@ | ||
import project.Any.Any | ||
|
||
import project.Data.Vector.Vector | ||
|
||
polyglot java import com.ibm.icu.text.Normalizer2.Mode | ||
|
||
## Enso representations of `com.ibm.icu.text.Normalizer2.Mode`. Does not | ||
include all values of `Mode`. | ||
type Normalization | ||
## Unicode NFC normalization mode. | ||
NFC | ||
|
||
## Unicode NFD normalization mode. | ||
NFD | ||
|
||
## Unicode NFKC normalization mode. | ||
NFKC | ||
|
||
## Unicode NFKD normalization mode. | ||
NFKD | ||
|
||
## Unicode NFKC_CF normalization mode. | ||
NFKCCasefold | ||
|
||
## PRIVATE | ||
get_java_mode : Any | ||
get_java_mode self = case self of | ||
Normalization.NFC -> Mode.COMPOSE | ||
Normalization.NFD -> Mode.DECOMPOSE | ||
Normalization.NFKC -> Mode.COMPOSE | ||
Normalization.NFKD -> Mode.DECOMPOSE | ||
Normalization.NFKCCasefold -> Mode.COMPOSE | ||
|
||
## PRIVATE | ||
get_mode_name : Any | ||
get_mode_name self = case self of | ||
Normalization.NFC -> "nfc" | ||
Normalization.NFD -> "nfc" | ||
Normalization.NFKC -> "nfkc" | ||
Normalization.NFKD -> "nfkc" | ||
Normalization.NFKCCasefold -> "nfkc_cf" |
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
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
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