Collation
This article needs additional citations for verification. (March 2019) |
Collation is the assembly of written information into a standard order. Many systems of collation are based on
Collation differs from
Formally speaking, a collation method typically defines a
A collation algorithm such as the
The main advantage of collation is that it makes it fast and easy for a user to find an element in the list, or to confirm that it is absent from the list. In automatic systems this can be done using a binary search algorithm or interpolation search; manual searching may be performed using a roughly similar procedure, though this will often be done unconsciously. Other advantages are that one can easily find the first or last elements on the list (most likely to be useful in the case of numerically sorted data), or elements in a given range (useful again in the case of numerical data, and also with alphabetically ordered data when one may be sure of only the first few letters of the sought item or items).
Ordering
Numerical and chronological
Strings representing numbers may be sorted based on the values of the numbers that they represent. For example, "−4", "2.5", "10", "89", "30,000". Pure application of this method may provide only a partial ordering on the strings, since different strings can represent the same number (as with "2" and "2.0" or, when scientific notation is used, "2e3" and "2000").
A similar approach may be taken with strings representing dates or other items that can be ordered chronologically or in some other natural fashion.
Alphabetical
Alphabetical order is the basis for many systems of collation where items of information are identified by strings consisting principally of letters from an alphabet. The ordering of the strings relies on the existence of a standard ordering for the letters of the alphabet in question. (The system is not limited to alphabets in the strict technical sense; languages that use a syllabary or abugida, for example Cherokee, can use the same ordering principle provided there is a set ordering for the symbols used.)
To decide which of two strings comes first in alphabetical order, initially their first letters are compared. The string whose first letter appears earlier in the alphabet comes first in alphabetical order. If the first letters are the same, then the second letters are compared, and so on, until the order is decided. (If one string runs out of letters to compare, then it is deemed to come first; for example, "cart" comes before "carthorse".) The result of arranging a set of strings in alphabetical order is that words with the same first letter are grouped together, and within such a group words with the same first two letters are grouped together, and so on.
Certain limitations, complications, and special conventions may apply when alphabetical order is used:
- When strings contain spaces or other word dividers, the decision must be taken whether to ignore these dividers or to treat them as symbols preceding all other letters of the alphabet. For example, if the first approach is taken then "car park" will come after "carbon" and "carp" (as it would if it were written "carpark"), whereas in the second approach "car park" will come before those two words. The first rule is used in many (but not all) dictionaries, the second in telephone directories(so that Wilson, Jim K appears with other people named Wilson, Jim and not after Wilson, Jimbo).
- Abbreviations may be treated as if they were spelt out in full. For example, names containing "St." (short for the English word Saint) are often ordered as if they were written out as "Saint". There is also a traditional convention in English that surnames beginning Mc and M' are listed as if those prefixes were written Mac.
- Strings that represent personal names will often be listed by alphabetical order of surname, even if the given name comes first. For example, Juan Hernandes and Brian O'Leary should be sorted as "Hernandes, Juan" and "O'Leary, Brian" even if they are not written this way.
- Very common initial words, such as The in English, are often ignored for sorting purposes. So The Shining would be sorted as just "Shining" or "Shining, The".
- When some of the strings contain , they may be sorted as if they were those letters.
- Languages have different conventions for treating modified letters and certain letter combinations. For example, in Spanish the letter ñ is treated as a basic letter following n, and the digraphs ch and ll were formerly (until 1994) treated as basic letters following c and l, although they are now alphabetized as two-letter combinations. A list of such conventions for various languages can be found at Alphabetical order § Language-specific conventions.
In several languages the rules have changed over time, and so older dictionaries may use a different order than modern ones. Furthermore, collation may depend on use. For example, German dictionaries and telephone directories use different approaches.
Root sorting
Some
Radical-and-stroke sorting
- See also Chinese characters and Chinese character orders
Another form of collation is radical-and-stroke sorting, used for non-alphabetic writing systems such as the
The radical-and-stroke system is cumbersome compared to an alphabetical system in which there are a few characters, all unambiguous. The choice of which components of a logograph comprise separate radicals and which radical is primary is not clear-cut. As a result, logographic languages often supplement radical-and-stroke ordering with alphabetic sorting of a phonetic conversion of the logographs. For example, the kanji word Tōkyō (東京) can be sorted as if it were spelled out in the Japanese characters of the hiragana syllabary as "to-u-ki-yo-u" (とうきょう), using the conventional sorting order for these characters.[citation needed]
In addition, Chinese characters can also be sorted by stroke-based sorting. In Greater China, surname stroke ordering is a convention in some official documents where people's names are listed without hierarchy.
Automation
When information is stored in digital systems, collation may become an automated process. It is then necessary to implement an appropriate collation algorithm that allows the information to be sorted in a satisfactory manner for the application in question. Often the aim will be to achieve an alphabetical or numerical ordering that follows the standard criteria as described in the preceding sections. However, not all of these criteria are easy to automate.[3]
The simplest kind of automated collation is based on the numerical codes of the symbols in a
In many collation algorithms, the comparison is based not on the numerical codes of the characters, but with reference to the collating sequence – a sequence in which the characters are assumed to come for the purpose of collation – as well as other ordering rules appropriate to the given application. This can serve to apply the correct conventions used for alphabetical ordering in the language in question, dealing properly with differently cased letters,
Problems are nonetheless still common when the algorithm has to encompass more than one language. For example, in
A standard algorithm for collating any collection of strings composed of any standard
Sort keys
In some applications, the strings by which items are collated may differ from the identifiers that are displayed. For example, The Shining might be sorted as Shining, The (see Alphabetical order above), but it may still be desired to display it as The Shining. In this case two sets of strings can be stored, one for display purposes, and another for collation purposes. Strings used for collation in this way are called sort keys.
Issues with numbers
Sometimes, it is desired to order text with embedded numbers using proper numerical order. For example, "Figure 7b" goes before "Figure 11a", even though '7' comes after '1' in
Sorting decimals properly is a bit more difficult, because different locales use different symbols for a
Labeling of ordered items
In some contexts, numbers and letters are used not so much as a basis for establishing an ordering, but as a means of labeling items that are already ordered. For example, pages, sections, chapters, and the like, as well as the items of lists, are frequently "numbered" in this way. Labeling series that may be used include ordinary
When letters of an alphabet are used for this purpose of
See also
- Alphabetical order
- Asciibetical order
- Chinese character orders
- Sorting
- Taxonomic sequence
- Mac and Mc together
- Unicode equivalence
- Natural sort order
Notes
- telegraphconventions).
References
- JSTOR 615409.
- ^ "Hans Wehr Arabic-English Dictionary". ejtaal.net. Retrieved 2023-06-04.
- ^ a b M Programming: A Comprehensive Guide, Richard F. Walters, Digital Press, 1997
External links
- Unicode Collation Algorithm: Unicode Technical Standard #10
- Collation in Spanish Archived 2006-08-13 at the Wayback Machine
- Collation of the names of the member states of the United NationsArchived August 30, 2005, at the Wayback Machine
- Typographical collation for many languages, as proposed in the List module of Cascading Style Sheets.
- Collation Charts: Charts demonstrating language-specific sorting orders in various operating systems and DBMS
- ICU Locale Explorer Archived 2008-05-11 at the Unicode Collation Algorithm with International Components for Unicode