Safekipedia

Collation

Discoverer · ages 10+Adapted from Wikipedia

Collation is the process of arranging written information into a standard order. Many collation systems are based on numerical order or alphabetical order, or on extensions and combinations of these. Collation is a basic part of most office filing systems, library catalogs, and reference books.

Collation is different from classification. In classification, the groups themselves do not have to be in any particular order. Even so, the labels for those groups may follow an order, which lets a sorting algorithm arrange items by group.

In more formal terms, a collation method sets a total order on a group of possible identifiers, called sort keys. This gives a total preorder on the items of information, though items with the same identifier are not put in any set order.

A collation algorithm, such as the Unicode collation algorithm, defines an order by comparing two character strings and deciding which one should come first. Once an order has been set this way, a sorting algorithm can place any number of items into that order.

The main advantage of collation is that it makes it quick and easy for a person to find an item in a list, or to check that it is not there. Computers can do this with a binary search algorithm or interpolation search. People often search by hand using a roughly similar method, although they often do this without thinking about it. Collation also makes it easy to find the first or last items in a list, or items within a certain range. This is especially useful for numbers, and for alphabetical lists when a person knows only the first few letters of what they are looking for.

This article is about collation in library, information, and computer science. For other uses, see Collation (disambiguation). "sortkey" redirects here. For Wikipedia's use of sortkeys in categories, see WP:SORTKEY.

Ordering

Strings that show numbers can be put in order by the values of the numbers they show, such as "−4", "2.5", "10", "89", and "30,000". This method may not fully sort everything, because different strings can show the same number, like "2" and "2.0", or "2e3" and "2000" when scientific notation is used. A similar idea works for strings showing dates or other things that can be put in time order or another natural order.

Main article: Alphabetical order

Alphabetical order is the basis for many ways of sorting, where items are named with strings made mostly of letters from an alphabet. This also works for languages that use a syllabary or abugida, such as Cherokee, as long as their symbols have a set order. To compare two strings, first compare their first letters. The one whose letter comes earlier in the alphabet goes first. If the letters match, compare the second letters, and so on. If one string runs out of letters, it goes first, so "cart" comes before "carthorse". Capital letters are usually treated the same as small letters, though computerized systems may handle them differently. Some choices can change the order. Spaces can be ignored, as in many dictionaries, or treated as coming before all letters, as in telephone directories. Short forms like "St." are often read as "Saint", and surnames are often sorted before given names. Common words like "The" may be skipped, so The Shining could be sorted as "Shining". Numbers may be placed before or after all letters, or spelled out, and symbols like those in 1337 for leet or Se7en for the film Seven may be sorted as letters. Rules for modified letters differ by language. In Spanish, "ñ" comes after "n", and the digraphs "ch" and "ll" were treated as single letters until 1994. A list of these rules is at Alphabetical order § Language-specific conventions. Rules have also changed over time, so older dictionaries may use a different order, and German dictionaries and telephone directories follow different approaches.

Root sorting

Some Arabic dictionaries, such as Hans Wehr's bilingual A Dictionary of Modern Written Arabic, group and sort Arabic words by semitic root. A root is a set of letters that carries a basic meaning.

For example, the words kitāba ('writing'), kitāb ('book'), kātib ('writer'), maktaba ('library'), maktab ('office'), and maktūb ('fate,' or 'written') are all placed under the triliteral root k-t-b (ك ت ب), which means 'writing'.

Radical-and-stroke sorting

See also: Chinese characters and Chinese character orders

Another way to sort information is radical-and-stroke sorting. It is used for writing systems that do not use an alphabet, such as the hanzi of Chinese and the kanji of Japanese. These languages have thousands of symbols, so they cannot be put in order like letters. Instead, common parts of characters are found. In Chinese and related systems, these parts are called radicals. Characters are grouped by their main radical, and then ordered by how many pen strokes they have. For example, the character 妈 (meaning "mother") is sorted as a six-stroke character under the three-stroke radical 女 (meaning "woman").

This system is harder to use than an alphabet, which has only a few letters that are always clear. It is not always obvious which parts of a character are radicals or which one is the main radical. Because of this, languages with these symbols often also sort words by how they sound. For example, Japanese words can be sorted using the hiragana writing system. Chinese characters can also be sorted by stroke-based sorting. In Greater China, surname stroke ordering is used in some official documents, where people's names are listed without any ranking.

Automation

When information is stored on computers, sorting can happen automatically. The computer needs a suitable algorithm that sorts the information in a way that works for the task. The simplest method uses the number codes of symbols in a character set, such as ASCII or its supersets like Unicode. This puts capital letters before lowercase ones, and it is sometimes called ASCIIbetical order. Because this differs from normal alphabetical order, it is often changed by converting letters to uppercase first. Better methods follow language rules for modified letters, digraphs, and other special cases, as described in the Alphabetical order article. Languages still cause problems, though. In German dictionaries, ökonomisch comes between offenbar and olfaktorisch, while Turkish dictionaries treat o and ö as different letters. The Unicode Collation Algorithm is a standard method that can be adjusted for each language using data from the Common Locale Data Repository.

Sometimes the text used for sorting is different from the title that is shown. For example, The Shining might be sorted as Shining, The, following the rules in Alphabetical order, while it is still displayed as The Shining. Text used this way is called a sort key. Numbers in text can also be sorted in proper numerical order, so "Figure 7b" comes before "Figure 11a," even though 7 comes after 1 in Unicode. This can also work with Roman numerals. Microsoft Windows sorts file names this way, using what is called natural sort order. Sorting decimal numbers is harder, because different regions use different symbols for a decimal point, and the same symbol can also separate parts of a number, as in "Section 3.2.5" where a decimal point is used. There is no single right answer, so the rules depend on the application.

Labeling of ordered items

Sometimes numbers and letters are used not to put items in order, but to label items that are already in order. Pages, sections, chapters, and the items in lists are often labeled this way. Common labels include Arabic numerals (1, 2, 3, ...), Roman numerals (I, II, III, ... or i, ii, iii, ...), or letters (A, B, C, ... or a, b, c, ...). A list can also be shown without numbers, using a bulleted list.

When letters of an alphabet are used for enumeration, each language has its own rules about which letters to use. For example, in Russian, the letters Ъ and Ь, which are only used to change the sound of the consonant before them, are usually left out. The letters Ы, Й, and Ё are also often left out. In many languages that use extended Latin script, the modified letters are often not used for labeling.

Quiz time!

5 questions about Collation

Question 1 of 5

What is collation?

Keep exploring

This article is a child-friendly adaptation of the Wikipedia article on Collation, available under CC BY-SA 4.0.