Wikifunctions:Type proposals/Unicode General Category
Summary
An enumeration of the possible values of a Unicode code point (Z86)'s General_Category property, as described at w:Unicode character property#General Category or the Unicode Character Database docs. From the latter: The General_Category values constitute a rough partitioning of characters to make distinctions for algorithmic processing [...]
Uses
These categories are used to segment strings, for example with Regular Expressions \p.
They're exposed in every Unicode processing library as they're a core part of the spec.
Structure
A Typed enum of Wikidata references (Z6884).
The grouped values (e.g. \p{N} = (\p{Nd}|\p{Nl}|\p{No})) are provided as a convenience for implementations, such as regex, which may wish to match more generic categories, such as "letter" or "number"
and no code point is in those categories directly. So we could exclude them from the enum, forcing users to represent those as sets of values.
Example values
- Q128748823 (Q128748823)
- Q138642197 (Q138642197)
- Q138642199 (Q138642199)
- Q138642200 (Q138642200)
- Q138642201 (Q138642201)
- Q138642208 (Q138642208)
- Q138642210 (Q138642210)
- Q138642213 (Q138642213)
- Q138642218 (Q138642218)
- Q138642219 (Q138642219)
- Q138642234 (Q138642234)
- Q138642235 (Q138642235)
- Q138642236 (Q138642236)
- Q138642246 (Q138642246)
- Q138642247 (Q138642247)
- Q138642248 (Q138642248)
- Q138642253 (Q138642253)
- Q138642254 (Q138642254)
- Q138642256 (Q138642256)
- Q138642259 (Q138642259)
- Q138642260 (Q138642260)
- Q138642261 (Q138642261)
- Q138642278 (Q138642278)
- Q138642279 (Q138642279)
- Q138642287 (Q138642287)
- Q138642290 (Q138642290)
- Q138642298 (Q138642298)
- Q138642299 (Q138642299)
- Q138642302 (Q138642302)
and maybe
Validator
Identity
Converting to code
Display function
Print the 2-letter identifier from the spec.
You could have alternate display functions which give the name of the category (pulling localised labels from Wikidata?) or the QID.
Read function
Accept the 2-letter identifier from the spec. None of the categories start with a 'Q' so it should be safe to accept QIDs as well.
Alternatives
none considered
Comments
For general comments, please reply to the proposer.
Support as proposer. YoshiRulz (talk) 21:42, 27 July 2025 (UTC)
- Along with the grouped categories,
Cnis also not used by any characterbecause that data file [UnicodeData.txt] does not list unassigned code points.
I think knowing that can help, in a way, with deciding which Items to include: Is this an enum of the categories a character can possibly be in, or is it an enum of all the defined categories? The latter would be more useful, as it is in RegEx. YoshiRulz (talk) 08:39, 11 March 2026 (UTC)
- Along with the grouped categories,
Support I think that we could create the Wikidata items (I think they should respect the Wikidata criteria for notability, right?). Obviously, being a lighteight Wikidata enumeration, there won't be any reading and display functions. Dv103 (talk) 06:57, 11 September 2025 (UTC)
Support Go ahead and create these on Wikidata first. --99of9 (talk) 05:21, 11 March 2026 (UTC)
Support --Ameisenigel (talk) 08:21, 12 May 2026 (UTC)