Debian Codegraph @

tests/yaml/backtranslation_emphasis.yaml

raw symbols SCIP
1 # Test backtranslation emphasis/typeform detection
2 #
3 # This tests that emphasis indicators in braille are correctly
4 # recognized and the typeform buffer is populated during backtranslation.
5 #
6 # The expected_typeform option specifies the expected typeform output
7 # for each character position. Use emphasis class names (italic, bold,
8 # underline) with '+' for emphasized and ' ' for plain text.
9
10 display: tables/unicode-without-blank.dis
11 table: tables/en-ueb-g1.ctb
12
13 flags:
14 testmode: backward
15
16 tests:
17 - # plain text - no emphasis
18 - "⠓⠑⠇⠇⠕"
19 - "hello"
20
21 - # single letter italic (dots 46-23)
22 - "⠨⠆⠞⠑⠎⠞"
23 - "test"
24 - expected_typeform:
25 italic: '+ '
26
27 - # single letter bold (dots 45-23)
28 - "⠘⠆⠞⠑⠎⠞"
29 - "test"
30 - expected_typeform:
31 bold: '+ '
32
33 - # single letter underline (dots 456-23)
34 - "⠸⠆⠞⠑⠎⠞"
35 - "test"
36 - expected_typeform:
37 underline: '+ '
38
39 - # word italic with explicit terminator
40 - "⠨⠂⠺⠕⠗⠙⠨⠄"
41 - "word"
42 - expected_typeform:
43 italic: '++++'
44
45 - # word bold with explicit terminator
46 - "⠘⠂⠺⠕⠗⠙⠘⠄"
47 - "word"
48 - expected_typeform:
49 bold: '++++'
50
51 - # word underline with explicit terminator
52 - "⠸⠂⠺⠕⠗⠙⠸⠄"
53 - "word"
54 - expected_typeform:
55 underline: '++++'
56
57 - # phrase italic spanning multiple words
58 - "⠨⠶⠓⠊ ⠞⠓⠑⠗⠑⠨⠄"
59 - "hi there"
60 - expected_typeform:
61 italic: '++++++++'
62
63 - # mixed text with letter italic in middle
64 - "⠁⠨⠆⠃⠉"
65 - "abc"
66 - expected_typeform:
67 italic: ' + '
68
69 - # word emphasis followed by plain text
70 - "⠨⠂⠓⠊⠨⠄ ⠞⠓⠑⠗⠑"
71 - "hi there"
72 - expected_typeform:
73 italic: '++ '
74
75 - # nested emphasis - bold word inside italic phrase
76 - "⠨⠶⠓⠊ ⠘⠂⠃⠕⠇⠙⠘⠄ ⠞⠓⠑⠗⠑⠨⠄"
77 - "hi bold there"
78 - expected_typeform:
79 italic: '+++++++++++++'
80 bold: ' ++++ '
81
82 - # multiple word emphasis - italic and bold on same word
83 - "⠨⠂⠘⠂⠞⠑⠎⠞⠘⠄⠨⠄"
84 - "test"
85 - expected_typeform:
86 italic: '++++'
87 bold: '++++'
88
89 - # letter underline inside word italic
90 - "⠨⠂⠞⠸⠆⠑⠎⠞⠨⠄"
91 - "test"
92 - expected_typeform:
93 italic: '++++'
94 underline: ' + '
95
96 - # three letter emphasis types on first character
97 - "⠨⠆⠸⠆⠘⠆⠞⠑⠎⠞"
98 - "test"
99 - expected_typeform:
100 italic: '+ '
101 underline: '+ '
102 bold: '+ '
103
104 # === Edge Case Tests ===
105
106 - # emphasis type transition within word
107 - "⠨⠂⠁⠃⠨⠄⠘⠂⠉⠙⠘⠄"
108 - "abcd"
109 - expected_typeform:
110 italic: '++ '
111 bold: ' ++'
112
113 - # punctuation at end of word emphasis
114 - "⠨⠂⠞⠑⠎⠞⠖⠨⠄"
115 - "test!"
116 - expected_typeform:
117 italic: '+++++'
118
119 - # word emphasis at end of input (no terminator)
120 - "⠨⠂⠞⠑⠎⠞"
121 - "test"
122 - expected_typeform:
123 italic: '++++'
124
125 - # phrase emphasis at end of input (no terminator)
126 - "⠨⠶⠓⠑⠇⠇⠕"
127 - "hello"
128 - expected_typeform:
129 italic: '+++++'
130
131 - # letter emphasis at end of input (no character follows)
132 - "⠁⠨⠆"
133 - "a"
134 - expected_typeform:
135 italic: ' '
136
137 - # single character letter emphasis
138 - "⠨⠆⠁ ⠃⠉"
139 - "a bc"
140 - expected_typeform:
141 italic: '+ '
142
143 - # letter emphasis followed by word emphasis
144 - "⠨⠆⠞⠘⠂⠑⠎⠞⠘⠄"
145 - "test"
146 - expected_typeform:
147 italic: '+ '
148 bold: ' +++'
149
150 - # phrase emphasis with mixed punctuation
151 - "⠨⠶⠓⠊⠂ ⠞⠓⠑⠗⠑⠖⠨⠄"
152 - "hi, there!"
153 - expected_typeform:
154 italic: '++++++++++'
155
156 - # empty input between emphasis indicators
157 - "⠨⠂⠨⠄"
158 - ""
159 - expected_typeform:
160 italic: ''
161
162 - # bold phrase containing italic word
163 - "⠘⠶⠁ ⠨⠂⠃⠨⠄ ⠉⠘⠄"
164 - "a b c"
165 - expected_typeform:
166 bold: '+++++'
167 italic: ' + '
168
169 # Grade 2 contraction tests - verify emphasis applies to all expanded characters
170 table: tables/en-ueb-g2.ctb
171
172 flags:
173 testmode: backward
174
175 tests:
176 - # contraction "the" with word italic - all 3 chars get emphasis
177 - "⠨⠂⠮⠨⠄"
178 - "the"
179 - expected_typeform:
180 italic: '+++'
181
182 - # contraction "and" with word bold - all 3 chars get emphasis
183 - "⠘⠂⠯⠘⠄"
184 - "and"
185 - expected_typeform:
186 bold: '+++'
187
188 - # contraction "for" with letter italic - all 3 chars get emphasis
189 - "⠨⠆⠿"
190 - "for"
191 - expected_typeform:
192 italic: '+++'
193
194 - # phrase emphasis spanning multiple contractions
195 - "⠨⠶⠮ ⠯⠨⠄"
196 - "the and"
197 - expected_typeform:
198 italic: '+++++++'
199
200 - # mixed contractions and regular letters with word emphasis
201 - "⠨⠂⠮⠗⠑⠨⠄"
202 - "there"
203 - expected_typeform:
204 italic: '+++++'
205
206 - # letter emphasis on contraction followed by plain text
207 - "⠨⠆⠮ ⠺⠕⠗⠙"
208 - "the word"
209 - expected_typeform:
210 italic: '+++ '
211
212 - # word emphasis contraction with implicit space termination
213 - "⠨⠂⠮ ⠯"
214 - "the and"
215 - expected_typeform:
216 italic: '++++ '
217
218 # === Additional Edge Case Tests ===
219
220 # Reset to Grade 1 for more edge case tests
221 table: tables/en-ueb-g1.ctb
222
223 flags:
224 testmode: backward
225
226 tests:
227 - # punctuation followed by space - does punctuation act as word boundary?
228 # begemphword + "hi" + period + space + "no"
229 # Currently only space clears word emphasis, so period should retain emphasis
230 - "⠨⠂⠓⠊⠲ ⠝⠕"
231 - "hi. no"
232 - expected_typeform:
233 italic: '++++ '
234
235 - # consecutive word emphasis blocks (same type)
236 # Two separate italic word blocks: "ab" italic, space, "cd" italic
237 - "⠨⠂⠁⠃⠨⠄ ⠨⠂⠉⠙⠨⠄"
238 - "ab cd"
239 - expected_typeform:
240 italic: '++ ++'
241
242 - # consecutive word emphasis blocks (different types)
243 # Italic word "ab", space, bold word "cd"
244 - "⠨⠂⠁⠃⠨⠄ ⠘⠂⠉⠙⠘⠄"
245 - "ab cd"
246 - expected_typeform:
247 italic: '++ '
248 bold: ' ++'
249
250 - # multiple consecutive spaces
251 # Word italic "ab" + multiple spaces + plain "cd"
252 - "⠨⠂⠁⠃ ⠀⠀⠉⠙"
253 - "ab cd"
254 - expected_typeform:
255 italic: '+++ '
256
257 - # word emphasis implicit termination followed by NEW word emphasis
258 # italic "hello" + space (implicit termination) + bold "name" + space + plain "is"
259 - "⠨⠂⠓⠑⠇⠇⠕ ⠘⠂⠝⠁⠍⠑⠘⠄ ⠊⠎"
260 - "hello name is"
261 - expected_typeform:
262 italic: '++++++ '
263 bold: ' ++++ '
264
265 - # punctuation immediately followed by new emphasis (no space)
266 # Word italic "hi" + comma + immediately start bold "no"
267 - "⠨⠂⠓⠊⠂⠨⠄⠘⠂⠝⠕⠘⠄"
268 - "hi,no"
269 - expected_typeform:
270 italic: '+++ '
271 bold: ' ++'
272
273 - # different emphasis types in sequence separated by space
274 # Italic "ab" + space + bold "cd" + space + underline "ef"
275 - "⠨⠂⠁⠃⠨⠄ ⠘⠂⠉⠙⠘⠄ ⠸⠂⠑⠋⠸⠄"
276 - "ab cd ef"
277 - expected_typeform:
278 italic: '++ '
279 bold: ' ++ '
280 underline: ' ++'
281
282 - # word emphasis without explicit terminator, followed by new word emphasis after space
283 # italic "ab" + space (implicit termination) + bold "cd"
284 - "⠨⠂⠁⠃ ⠘⠂⠉⠙⠘⠄"
285 - "ab cd"
286 - expected_typeform:
287 italic: '+++ '
288 bold: ' ++'
289
290 - # comma between two emphasized words with restart
291 # italic "hi" + comma + space + italic "no" (restart emphasis)
292 - "⠨⠂⠓⠊⠂ ⠨⠂⠝⠕⠨⠄"
293 - "hi, no"
294 - expected_typeform:
295 italic: '++++++'
296
297 - # phrase emphasis spanning punctuation and multiple words
298 # Tests that phrase emphasis is NOT cleared by space
299 - "⠨⠶⠁⠲ ⠃⠲ ⠉⠨⠄"
300 - "a. b. c"
301 - expected_typeform:
302 italic: '+++++++'
303
304 - # empty word (only space between emphasis indicators)
305 - "⠨⠂ ⠨⠄"
306 - " "
307 - expected_typeform:
308 italic: '+'
309
310 - # word emphasis at word boundary with following plain text
311 # Tests precise boundary handling
312 - "⠨⠂⠁⠃⠉⠨⠄ ⠙⠑⠋"
313 - "abc def"
314 - expected_typeform:
315 italic: '+++ '
316
317 - # two consecutive letter emphasis indicators (different types)
318 # italic letter + bold letter on first char
319 - "⠨⠆⠘⠆⠁⠃⠉"
320 - "abc"
321 - expected_typeform:
322 italic: '+ '
323 bold: '+ '
324
325 - # phrase italic with word bold inside, word bold terminated by space
326 # phrase covers all, word bold on "hi" + space (emphasis applied before clearing at space)
327 - "⠨⠶⠘⠂⠓⠊ ⠞⠓⠑⠗⠑⠨⠄"
328 - "hi there"
329 - expected_typeform:
330 italic: '++++++++'
331 bold: '+++ '
332
333 - # multiple word emphasis blocks with no content between
334 # italic word terminator immediately followed by bold word start
335 - "⠨⠂⠁⠃⠨⠄⠘⠂⠉⠙⠘⠄"
336 - "abcd"
337 - expected_typeform:
338 italic: '++ '
339 bold: ' ++'
340
341 - # phrase bold terminated correctly (endemph ambiguity)
342 # In UEB, endemphword and endemphphrase bold share the same dot pattern (45-3).
343 # The backtranslator must end phrase emphasis, not just word emphasis.
344 - "⠘⠶⠓⠑⠇⠇⠕⠘⠄ ⠺⠕⠗⠇⠙"
345 - "hello world"
346 - expected_typeform:
347 bold: '+++++ '
348
349 - # phrase bold followed by multiple plain words
350 - "⠘⠶⠓⠊⠘⠄ ⠍⠽ ⠝⠁⠍⠑"
351 - "hi my name"
352 - expected_typeform:
353 bold: '++ '