The Unicode Collation Algorithm (UTS #10) and CLDR locale tailorings in Zig: sort text the way people expect rather than by code point.
zig-collate GLOSSARY.md
3.3 kB · 99 lines
Markdown
at main

Collation #

The vocabulary of comparing, sorting and searching text by the Unicode Collation Algorithm (UTS #10) and CLDR's tailorings of it.

Ordering #

Collation element: One unit of weight a character or sequence of characters maps to, carrying a primary, secondary and tertiary weight (and, here, a fourth). Avoid: CE (in prose), weight tuple

Strength: How many levels of weight a comparison looks at: primary (base letters), secondary (accents), tertiary (case and variants), quaternary, identical. Avoid: level (when the setting is meant), sensitivity

Tailoring: A locale's changes to the root collation, such as Danish sorting å after z and treating aa as å. Avoid: locale rules, customization

Sort key: A byte string whose binary order is the collation's order for the string it was built from. Avoid: collation key, match key

Searching #

Pattern: The string being searched for. Avoid: query, needle

Target: The string being searched in. Avoid: haystack, text, subject

Match: A range of the target that the collation, at its strength, cannot tell apart from the pattern. Avoid: hit, occurrence

Minimal match: A match that excludes any ignorable characters around it. Avoid: tight match

Maximal match: A match that takes in the ignorable characters around it. Avoid: loose match

Match edge: A point in the target where a match may begin or end: between collation elements, and with nothing the collation weighed as one on both sides of it. Avoid: cut, split point

Match boundary: A constraint on where a match may start and end: nowhere in particular, or only between whole characters (grapheme clusters). Avoid: word boundary (unless whole words are meant)

Asymmetric search: A search in which an unmarked pattern character matches the same character marked or unmarked in the target, but a marked pattern character matches only the same mark. Avoid: one-way search, accent-insensitive search

Marked: Carrying more than the lowest weight at a level: an accent at the secondary level, uppercase or a compatibility variant at the tertiary. For kana the normal form is the unmarked one, and it is unmarked only among the forms of its own syllabary: hiragana is not an unmarked katakana. Avoid: decorated, modified

Fuzzy match: A match that may differ from the pattern by up to a given number of edits. Avoid: approximate match, near match

Edit: One character of the pattern left out, one of the target's put in, or one put in place of another. A character that weighs nothing at the strength searched at costs no edit to leave out or put in. Avoid: typo, error

Closeness: How near a match is to its pattern: by the number of characters changed, then the number of accent differences, then the number of case and variant differences. Avoid: score, relevance

Match key: A byte string built from a string's collation elements such that two strings with equal match keys match, and a pattern that matches inside a target has its match key inside the target's. Avoid: folded string, collation folding, sort key