Documentation ¶
Overview ¶
Package colltab contains functionality related to collation tables. It is only to be used by the collate and search packages.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MatchLang ¶
MatchLang finds the index of t in tags, using a matching algorithm used for collation and search. tags[0] must be language.Und, the remaining tags should be sorted alphabetically.
Language matching for collation and search is different from the matching defined by language.Matcher: the (inferred) base language must be an exact match for the relevant fields. For example, "gsw" should not match "de". Also the parent relation is different, as a parent may have a different script. So usually the parent of zh-Hant is und, whereas for MatchLang it is zh.
Types ¶
type Iter ¶
type Iter struct { Weighter colltab.Weighter Elems []colltab.Elem // N is the number of elements in Elems that will not be reordered on // subsequent iterations, N <= len(Elems). N int // contains filtered or unexported fields }
An Iter incrementally converts chunks of the input text to collation elements, while ensuring that the collation elements are in normalized order (that is, they are in the order as if the input text were normalized first).
func (*Iter) End ¶
End returns the end position of the input text for which Next has returned results.
func (*Iter) Next ¶
Next appends Elems to the internal array. On each iteration, it will either add starters or modifiers. In the majority of cases, an Elem with a primary value > 0 will have a CCC of 0. The CCC values of collation elements are also used to detect if the input string was not normalized and to adjust the result accordingly.
func (*Iter) Reset ¶
Reset sets the position in the current input text to p and discards any results obtained so far.
func (*Iter) SetInputString ¶
SetInputString resets i to input s.