package confero
Module ConferoSource
Collation Element Mappings
register_collation_mapping ~lang m registers m to be used for collating string representing text in the language lang.
register_collation_mapping m registers m to be used as a fall-back mapping when collate is called without an explicit mapping and either the language is unspecified or not mapping has been registered for the specified language. A good fall-back is provided by linking against the confero.ducet sublibrary.
This function updates global state and should only be used during program initialization by libraries providing collation mappings or by the main entry point of the application.
val infer_collation_mapping :
?lang:Iso639.Lang.t ->
?mapping:Collation_mapping.t ->
unit ->
Collation_mapping.tinfer_collation_mapping ?lang ?mapping () returns the mapping which would have been used by collate given the same named arguments.
Collation Algorithm
Vectors of weights derived from an input string and a collation element mapping.
A compact representations of a collation elements as private strings whose lexicographic byte order represent the collation order.
Collation
val collate :
?encoding:Uutf.encoding ->
?lang:Iso639.Lang.t ->
?mapping:Collation_mapping.t ->
?total:bool ->
string ->
string ->
intcollate ?encoding ?lang ?mapping s1 s2 returns a negative integer, zero, or a positive integer when s1 is ordered before s2, s1 and s2 are unordered, or s1 is ordered after s2, respectively, according to a collation mapping inferred from mapping and lang as follows:
- If
langis specified and a mapping has been registered forlangwithregister_collation_mappingthen it is used, else - if
mappingis specified then it is used, else - if a fall-back mapping has been registered with
register_collation_mappingthen it is used, else - a mapping using Unicode code point ordering is used.
Pass ~total:true when a total order is required, e.g. when using it as the implementation of Map.OrderedType.compare or Set.OrderedType.compare.