Debian Codegraph @

Documents/README.ContractionTables

raw
1 ~~~~~~~~~~~~~~~~~~
2 Contraction Tables
3 ~~~~~~~~~~~~~~~~~~
4
5 .. include:: prologue.rst
6
7 Description
8 ===========
9
10 Files with names of the form ``*.ctb`` are contraction tables, and with names
11 of the form ``*.cti`` are contraction subtables. They are used by BRLTTY to
12 translate character sequences on the screen into their corresponding contracted
13 braille representations.
14
15 Contraction tables can usually be found in the ``/etc/brltty/Contraction/``
16 directory (see |README.Customize| for more details). See
17 `Contraction Table List`_ for a list of BRLTTY's contraction tables.
18
19 A contraction table consists of a sequence of directives, one per line, that
20 define how character sequences are to be represented in contracted braille.
21 UTF-8 character encoding must be used. Whitespace (blanks, tabs) at the
22 beginning of a line, as well as before and/or after any operand, is ignored.
23 Lines containing only whitespace are ignored. If the first non-whitespace
24 character of a line is ``#`` then that line is a comment and is ignored.
25
26 Contraction Directives
27 ======================
28
29 The format of a contraction directive is:
30
31 .. parsed-literal:: *directive* *operand* ... *comment*
32
33 Each directive has a specific number of operands. Any text beyond the last
34 operand of a directive is interpreted as a comment. This commenting capability
35 is often used to list some of the words that make the directive necessary.
36
37 The order of the directives within a contraction table is, in general, anything
38 that is convenient for its maintainer(s). A directive that defines an entity,
39 e.g. `The Class Directive`_, must precede all references to that entity.
40
41 Directives that match character sequences are automatically rearranged such
42 that longer sequences are matched first. If more than one directive matches the
43 same character sequence then their original table ordering is maintained.
44
45 Whenever a character needs to be written, its representation as defined via
46 `The Always Directive`_ is used. In principle, this means that every character
47 within the *representation* operand of every contraction directive should be
48 explicitly defined via `The Always Directive`_. If a character's representation
49 hasn't been defined then the Unicode Replacement Character (U+FFFD) is used -
50 if its representation hasn't been defined then all eight dots are used.
51
52 The Literal Directive
53 ---------------------
54
55 .. parsed-literal:: literal *characters*
56
57 Translate the entire whitespace-bounded text containing the character sequence
58 into computer braille.
59
60 The Always Directive
61 --------------------
62
63 .. parsed-literal:: always *characters* *representation*
64
65 Unconditionally translate the characters no matter where they appear. If
66 there's only one character, then, in addition, define the default
67 representation for that character.
68
69 The Repeatable Directive
70 ------------------------
71
72 .. parsed-literal:: repeatable *characters* *representation*
73
74 Unconditionally translate the characters no matter where they appear. Ignore
75 any consecutive repetitions of the same sequence.
76
77 The LargeSign Directive
78 -----------------------
79
80 .. parsed-literal:: largeSign *characters* *representation*
81
82 Unconditionally translate the characters no matter where they appear. Remove
83 whitespace between consecutive words matched by this directive.
84
85 The LastLargeSign Directive
86 ---------------------------
87
88 .. parsed-literal:: lastLargeSign *characters* *representation*
89
90 Unconditionally translate the characters no matter where they appear. Remove
91 preceding whitespace if the previous word was matched by
92 `The LargeSign Directive`_.
93
94 The Word Directive
95 ------------------
96
97 .. parsed-literal:: word *characters* *representation*
98
99 Translate the characters if they're a word.
100
101 The JoinWord Directive
102 ----------------------
103
104 .. parsed-literal:: joinWord *characters* *representation*
105
106 Translate the characters if they're a word. Remove the following whitespace if
107 the first character after it is a letter.
108
109 The LowWord Directive
110 ---------------------
111
112 .. parsed-literal:: lowWord *characters* *representation*
113
114 Translate the characters if they're a whitespace-bounded word.
115
116 The Contraction Directive
117 -------------------------
118
119 .. parsed-literal:: contraction *characters*
120
121 Prefix the characters with a letter sign (see
122 `The LetSign Directive`_) if they're a word.
123
124 The SufWord Directive
125 ---------------------
126
127 .. parsed-literal:: sufWord *characters* *representation*
128
129 Translate the characters if they're either a word or at the beginning of a
130 word.
131
132 The PrfWord Directive
133 ---------------------
134
135 .. parsed-literal:: prfWord *characters* *representation*
136
137 Translate the characters if they're either a word or at the end of a word.
138
139 The BegWord Directive
140 ---------------------
141
142 .. parsed-literal:: begWord *characters* *representation*
143
144 Translate the characters if they're at the beginning of a word.
145
146 The BegMidWord Directive
147 ------------------------
148
149 .. parsed-literal:: begMidWord *characters* *representation*
150
151 Translate the characters if they're either at the beginning or in the middle of
152 a word.
153
154 The MidWord Directive
155 ---------------------
156
157 .. parsed-literal:: midWord *characters* *representation*
158
159 Translate the characters if they're in the middle of a word.
160
161 The MidEndWord Directive
162 ------------------------
163
164 .. parsed-literal:: midEndWord *characters* *representation*
165
166 Translate the characters if they're either in the middle or at the end of a
167 word.
168
169 The EndWord Directive
170 ---------------------
171
172 .. parsed-literal:: endWord *characters* *representation*
173
174 Translate the characters if they're at the end of a word.
175
176 The PrePunc Directive
177 ---------------------
178
179 .. parsed-literal:: prePunc *characters* *representation*
180
181 Translate the characters if they're part of punctuation at the beginning of a
182 word.
183
184 The PostPunc Directive
185 ----------------------
186
187 .. parsed-literal:: postPunc *characters* *representation*
188
189 Translate the characters if they're part of punctuation at the end of a word.
190
191 The BegNum Directive
192 --------------------
193
194 .. parsed-literal:: begNum *characters* *representation*
195
196 Translate the characters if they're at the beginning of a number.
197
198 The MidNum Directive
199 --------------------
200
201 .. parsed-literal:: midNum *characters* *representation*
202
203 Translate the characters if they're in the middle of a number.
204
205 The EndNum Directive
206 --------------------
207
208 .. parsed-literal:: endNum *characters* *representation*
209
210 Translate the characters if they're at the end of a number.
211
212 Character Classes
213 =================
214
215 The Class Directive
216 -------------------
217
218 .. parsed-literal:: class *name* *characters*
219
220 Define a new character class. A character class may not be used until it has
221 been defined.
222
223 The After Directive
224 -------------------
225
226 .. parsed-literal:: after *class* *directive*
227
228 The specified directive is further constrained in that the matched character
229 sequence must be immediately preceded by a character belonging to the specified
230 class. If this directive is used more than once on the same line then the union
231 of the characters in all the classes is used.
232
233 The Before Directive
234 --------------------
235
236 .. parsed-literal:: before *class* *directive*
237
238 The specified directive is further constrained in that the matched character
239 sequence must be immediately followed by a character belonging to the specified
240 class. If this directive is used more than once on the same line then the union
241 of the characters in all the classes is used.
242
243 Indicator Specification
244 =======================
245
246 The CapSign Directive
247 ---------------------
248
249 .. parsed-literal:: capSign *representation*
250
251 Define the symbol which capitalizes a single letter.
252
253 The BegCaps Directive
254 ---------------------
255
256 .. parsed-literal:: begCaps *representation*
257
258 Define the symbol which begins a block of capital letters within a word.
259
260 The EndCaps Directive
261 ---------------------
262
263 .. parsed-literal:: endCaps *representation*
264
265 Define the symbol which ends a block of capital letters within a word.
266
267 The LetSign Directive
268 ---------------------
269
270 .. parsed-literal:: letSign *representation*
271
272 Define the symbol which marks a letter which isn't part of a word.
273
274 The NumSign Directive
275 ---------------------
276
277 .. parsed-literal:: numSign *representation*
278
279 Define the symbol which marks the beginning of a number.
280
281 Special Directives
282 ==================
283
284 The Replace Directive
285 ---------------------
286
287 .. parsed-literal:: replace *characters* *characters*
288
289 Translate the first character sequence into the second character sequence.
290 The replacement characters are then recontracted.
291
292 The Emoji Directive
293 -------------------
294
295 .. parsed-literal:: emoji *language*
296
297 Translate an emoji character sequence into its description in the specified
298 language. The language operand is an ISO 639 two-letter language code.
299
300 This directive only works if at least ICU version 57 is installed.
301
302 This directive relies on data provided by the CLDR package.
303 CLDR stands for the Common Locale Data Repository project.
304 Known names for this package include:
305
306 * cldr-emoji-annotation
307 * unicode-cldr
308
309 At the time of this writing, this project is maintained at
310 `<https://github.com/unicode-org/cldr>`_.
311
312 Standard Directives
313 ===================
314
315 .. include:: nesting-directives.rst
316
317 Operands
318 ========
319
320 .. include:: string-operand.rst
321
322 The Representation Operand
323 --------------------------
324
325 The contracted braille representation of a character sequence. Braille cells
326 are separated from one another by a minus (``-``) sign. Each braille cell is
327 specified as a sequence of one to eight dot numbers. A dot number is a digit
328 within the range ``1``-``8`` as defined by the standard braille dot numbering
329 convention (see |README.BrailleDots| for details). The special dot number
330 ``0`` means no dots, and may not be used in conjunction with any other dot
331 numbers.
332
333 The equals (``=``) sign, when used all by itself, means that the *characters*
334 operand of the contraction directive is to be written without any translation.
335
336 Contraction Table List
337 ======================
338
339 .. csv-table::
340 :header-rows: 1
341 :file: contraction-table.csv
342