Sorting
Command: SOrt
Purpose: Arrange the corefile lines or records in lexical order
Format: SO <digit>|<number>|<number>|<number>
Parameters: The four parameters work as follows:
- the first parameter, <digit>, is either 0 or 1 which specify ascending and descending order respectively. If no parameter is specified, ascending order is assumed.
- the second parameter, <number>, specifies the number of characters on a line over which the sort should operate.
- The last two parameters define the range of lines over which the sort will proceed. They are often omitted, or they may be replaced by * symbols, with the same interpretation as for the SAve command. If they are left blank, the entire file is sorted.
In TEXT view, the sort-key begins at the cursor and extends for n characters, where n is the key-length specified by the second parameter. If the key-length is negative, the sort-key runs from the cursor backwards (i.e. right- to-left).
In either of RECORD views, the position of the cursor selects a specific field of a record, and the sort-key is the corresponding field in every record.
Examples:
SO |5|*|* - sort the starred block in ascending order with key of length 5.
SO 1|-8 - sort the entire corefile in descending order. Sort-keys are compared from right to left with a key-length of 8.
Note: if a column of words is aligned by the right-hand end, this "reverse sort" brings together words with a similar ending:
walked edited spoke speaking walking editing speak walk speaks walks edits edit
Sorting accented characters
The basic ivi
sort uses the ISO-8859-1 character mapping to sort characters. Unfortunately, this means that accented characters, like the e acute, are placed at the end of the alphabet. To remedy this, the SKey command has been defined. In a nutshell, it permits a sequence of sorts based on either the letter ("e", for example), or the diacritic (the acute, grave, etc. accent).
Command: SKey
Purpose: Sort characters by base characters or diacritics
Format: SO <digit>
Parameters: There are three possible parameters:
- 0 - sort in standard ASCII order (the default)
- 1 - sort by base characters, ignoring diacritics
- 2 - sort by diacritics
To use the SKey command, type SK on the command line. You will see the prompt:
0: ASCII; 1: French unaccented; 2: accents
First, go to the top of the portion of the text to be sorted and type: SK 2 and then SO. The characters with accents will be sorted together in the appropriate order. Then, go back to the start of the block to be sorted and type SK 1 and then SO. Base characters will be sorted, with accented characters in the appropriate place with respect to their unaccented versions.
Example:
Suppose an initial text like this:
abbesse était elle êtes Esther femme
A regular sort will produce:
abbesse elle Esther était êtes femme
On the other hand, typing SK2 followed by SO will produce:
Esther elle femme abbesse était êtes
and SK1 followed by SO will give the final product of
abbesse elle Esther était êtes femme
Word and Sentence Length
This operation was provided for a class of humanities students exploring the use of computers to extract information from literary texts.
Operation: Length tables
Purpose: Construct word and sentence length tables for the text in the corefile
Default Key: <ESC> N
Operation Number: 105
The operation scans the text in the current corefile starting at the cursor and continuing to the end. Word and sentence length tables are appended to corefile 7.