braillebase 0.0.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
braillebase/__init__.py
ADDED
|
@@ -0,0 +1,953 @@
|
|
|
1
|
+
class BrailleBase:
|
|
2
|
+
#0000
|
|
3
|
+
def __init__(self):
|
|
4
|
+
self.__letter_brailles = {}
|
|
5
|
+
|
|
6
|
+
#0001-A
|
|
7
|
+
def append_braille_letter(self, letter: str, braille_list: list):
|
|
8
|
+
"""
|
|
9
|
+
EN
|
|
10
|
+
Registers a letter and its associated braille list. If the letter already exists, its mapping is overwritten.
|
|
11
|
+
|
|
12
|
+
JP
|
|
13
|
+
文字と対応する点字リストを登録します。すでに登録されている場合、そのマッピングは上書きされます。
|
|
14
|
+
|
|
15
|
+
IT
|
|
16
|
+
Registra una lettera e la lista di braille associata. Se la lettera esiste già, la mappatura viene sovrascritta.
|
|
17
|
+
|
|
18
|
+
PT
|
|
19
|
+
Registra uma letra e sua lista de brailles associada. Se a letra já existir, sua configuração é sobrescrita.
|
|
20
|
+
"""
|
|
21
|
+
if not isinstance(letter, str):
|
|
22
|
+
raise TypeError("letter must be a string")
|
|
23
|
+
|
|
24
|
+
if len(letter) == 0:
|
|
25
|
+
raise ValueError("letter cannot be empty")
|
|
26
|
+
|
|
27
|
+
self.__validate_braille_list(braille_list)
|
|
28
|
+
|
|
29
|
+
self.__letter_brailles[letter] = braille_list
|
|
30
|
+
|
|
31
|
+
#0001-B
|
|
32
|
+
def get_brailles_with_letter(self, letter: str):
|
|
33
|
+
"""
|
|
34
|
+
EN
|
|
35
|
+
Returns the braille list associated with the given letter. Raises an error if the letter is not registered.
|
|
36
|
+
|
|
37
|
+
JP
|
|
38
|
+
指定した文字に対応する点字リストを返します。登録されていない場合はエラーを発生させます。
|
|
39
|
+
|
|
40
|
+
IT
|
|
41
|
+
Restituisce la lista di braille associata alla lettera indicata. Genera un errore se la lettera non è registrata.
|
|
42
|
+
|
|
43
|
+
PT
|
|
44
|
+
Retorna a lista de brailles associada à letra informada. Gera um erro se a letra não estiver registrada.
|
|
45
|
+
"""
|
|
46
|
+
if letter not in self.__letter_brailles:
|
|
47
|
+
raise KeyError(f"letter '{letter}' not registered")
|
|
48
|
+
return self.__letter_brailles[letter]
|
|
49
|
+
|
|
50
|
+
#0001-C
|
|
51
|
+
def has_letter(self, letter: str) -> bool:
|
|
52
|
+
"""
|
|
53
|
+
EN
|
|
54
|
+
Checks whether the given letter is registered in the internal mapping. Returns True or False.
|
|
55
|
+
|
|
56
|
+
JP
|
|
57
|
+
指定した文字が内部マッピングに登録されているかを確認します。結果は True または False です。
|
|
58
|
+
|
|
59
|
+
IT
|
|
60
|
+
Verifica se la lettera indicata è registrata nella mappatura interna. Restituisce True o False.
|
|
61
|
+
|
|
62
|
+
PT
|
|
63
|
+
Verifica se a letra informada está registrada no mapeamento interno. Retorna True ou False.
|
|
64
|
+
"""
|
|
65
|
+
return letter in self.__letter_brailles
|
|
66
|
+
|
|
67
|
+
#0001-D
|
|
68
|
+
def remove_letter(self, letter: str):
|
|
69
|
+
"""
|
|
70
|
+
EN
|
|
71
|
+
Removes the given letter from the internal mapping. Returns True if the letter existed and was removed, otherwise returns False.
|
|
72
|
+
|
|
73
|
+
JP
|
|
74
|
+
指定した文字を内部マッピングから削除します。削除に成功した場合は True、存在しなかった場合は False を返します。
|
|
75
|
+
|
|
76
|
+
IT
|
|
77
|
+
Rimuove la lettera indicata dalla mappatura interna. Restituisce True se la lettera esisteva ed è stata rimossa, altrimenti False.
|
|
78
|
+
|
|
79
|
+
PT
|
|
80
|
+
Remove a letra informada do mapeamento interno. Retorna True se a letra existia e foi removida, caso contrário retorna False.
|
|
81
|
+
"""
|
|
82
|
+
if letter in self.__letter_brailles:
|
|
83
|
+
del self.__letter_brailles[letter]
|
|
84
|
+
return True
|
|
85
|
+
return False
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
#0001-E
|
|
89
|
+
def get_registered_letters(self):
|
|
90
|
+
"""
|
|
91
|
+
EN
|
|
92
|
+
Returns a list containing all letters currently registered in the internal mapping.
|
|
93
|
+
|
|
94
|
+
JP
|
|
95
|
+
内部マッピングに現在登録されているすべての文字を含むリストを返します。
|
|
96
|
+
|
|
97
|
+
IT
|
|
98
|
+
Restituisce una lista contenente tutte le lettere attualmente registrate nella mappatura interna.
|
|
99
|
+
|
|
100
|
+
PT
|
|
101
|
+
Retorna uma lista contendo todas as letras atualmente registradas no mapeamento interno.
|
|
102
|
+
"""
|
|
103
|
+
return list(self.__letter_brailles.keys())
|
|
104
|
+
|
|
105
|
+
#0001-F
|
|
106
|
+
def append_multiple_braille_letters(self, mapping: dict):
|
|
107
|
+
"""
|
|
108
|
+
EN
|
|
109
|
+
Registers multiple letter-to-braille mappings at once. Each entry is validated and added individually.
|
|
110
|
+
|
|
111
|
+
JP
|
|
112
|
+
複数の文字と点字の対応関係を一度に登録します。各項目は個別に検証されて追加されます。
|
|
113
|
+
|
|
114
|
+
IT
|
|
115
|
+
Registra più associazioni lettera‑braille in un’unica operazione. Ogni voce viene validata e aggiunta singolarmente.
|
|
116
|
+
|
|
117
|
+
PT
|
|
118
|
+
Registra várias associações letra‑braille de uma só vez. Cada item é validado e adicionado individualmente.
|
|
119
|
+
"""
|
|
120
|
+
if not isinstance(mapping, dict):
|
|
121
|
+
raise TypeError("mapping must be a dict")
|
|
122
|
+
|
|
123
|
+
for letter, braille_list in mapping.items():
|
|
124
|
+
self.append_braille_letter(letter, braille_list)
|
|
125
|
+
|
|
126
|
+
#0001-G
|
|
127
|
+
def edit_braille_letter(self, letter: str, new_braille_list: list):
|
|
128
|
+
"""
|
|
129
|
+
EN
|
|
130
|
+
Edits the braille list associated with the given letter. Raises an error if the letter is not registered.
|
|
131
|
+
|
|
132
|
+
JP
|
|
133
|
+
指定した文字に対応する点字リストを編集します。文字が登録されていない場合はエラーを発生させます。
|
|
134
|
+
|
|
135
|
+
IT
|
|
136
|
+
Modifica la lista di braille associata alla lettera indicata. Genera un errore se la lettera non è registrata.
|
|
137
|
+
|
|
138
|
+
PT
|
|
139
|
+
Edita a lista de brailles associada à letra informada. Gera um erro se a letra não estiver registrada.
|
|
140
|
+
"""
|
|
141
|
+
if letter not in self.__letter_brailles:
|
|
142
|
+
raise KeyError(f"letter '{letter}' not registered")
|
|
143
|
+
|
|
144
|
+
self.__validate_braille_list(new_braille_list)
|
|
145
|
+
|
|
146
|
+
self.__letter_brailles[letter] = new_braille_list
|
|
147
|
+
#------------------------------------------------------------------------------------------------------------------------------------
|
|
148
|
+
#0002-A
|
|
149
|
+
def translate_text_to_braille(self, text: str) -> list:
|
|
150
|
+
"""
|
|
151
|
+
EN
|
|
152
|
+
Translates the input text into a flat list of braille symbols. Each character may expand into multiple braille cells.
|
|
153
|
+
|
|
154
|
+
JP
|
|
155
|
+
入力テキストを点字記号のフラットなリストに変換します。文字によっては複数の点字セルに展開されます。
|
|
156
|
+
|
|
157
|
+
IT
|
|
158
|
+
Traduce il testo di input in una lista piatta di simboli braille. Alcuni caratteri possono espandersi in più celle braille.
|
|
159
|
+
|
|
160
|
+
PT
|
|
161
|
+
Traduz o texto de entrada para uma lista linear de símbolos braille. Alguns caracteres podem se expandir em múltiplas células braille.
|
|
162
|
+
"""
|
|
163
|
+
result = []
|
|
164
|
+
for ch in text:
|
|
165
|
+
brailles = self.get_brailles_with_letter(ch)
|
|
166
|
+
result.extend(brailles)
|
|
167
|
+
return result
|
|
168
|
+
|
|
169
|
+
#0002-B
|
|
170
|
+
def translate_text_to_index(self, text: str) -> list:
|
|
171
|
+
"""
|
|
172
|
+
EN
|
|
173
|
+
Translates the input text into a list of braille indices. Each character may expand into multiple braille cells.
|
|
174
|
+
|
|
175
|
+
JP
|
|
176
|
+
入力テキストを点字インデックスのリストに変換します。文字によっては複数の点字セルに展開されます。
|
|
177
|
+
|
|
178
|
+
IT
|
|
179
|
+
Traduce il testo di input in una lista di indici braille. Alcuni caratteri possono espandersi in più celle braille.
|
|
180
|
+
|
|
181
|
+
PT
|
|
182
|
+
Traduz o texto de entrada para uma lista de índices braille. Alguns caracteres podem se expandir em múltiplas células braille.
|
|
183
|
+
"""
|
|
184
|
+
brailles = self.translate_text_to_braille(text)
|
|
185
|
+
return BrailleBase.get_braille_list_to_index_list(brailles)
|
|
186
|
+
|
|
187
|
+
#0002-C
|
|
188
|
+
def translate_text_to_binary_string(self, text: str) -> list:
|
|
189
|
+
"""
|
|
190
|
+
EN
|
|
191
|
+
Translates the input text into a list of 6‑bit binary strings representing each braille cell.
|
|
192
|
+
|
|
193
|
+
JP
|
|
194
|
+
入力テキストを、各点字セルを表す 6 ビットのバイナリ文字列のリストに変換します。
|
|
195
|
+
|
|
196
|
+
IT
|
|
197
|
+
Traduce il testo di input in una lista di stringhe binarie a 6 bit che rappresentano ogni cella braille.
|
|
198
|
+
|
|
199
|
+
PT
|
|
200
|
+
Traduz o texto de entrada para uma lista de strings binárias de 6 bits que representam cada célula braille.
|
|
201
|
+
"""
|
|
202
|
+
brailles = self.translate_text_to_braille(text)
|
|
203
|
+
indices = BrailleBase.get_braille_list_to_index_list(brailles)
|
|
204
|
+
binary_strings = BrailleBase.get_binary_string_list()
|
|
205
|
+
return [binary_strings[i] for i in indices]
|
|
206
|
+
|
|
207
|
+
#0002-D
|
|
208
|
+
def translate_text_to_binary_list(self, text: str) -> list:
|
|
209
|
+
"""
|
|
210
|
+
EN
|
|
211
|
+
Translates the input text into a list of 6‑bit binary arrays representing each braille cell.
|
|
212
|
+
|
|
213
|
+
JP
|
|
214
|
+
入力テキストを、各点字セルを表す 6 ビットのバイナリ配列のリストに変換します。
|
|
215
|
+
|
|
216
|
+
IT
|
|
217
|
+
Traduce il testo di input in una lista di array binari a 6 bit che rappresentano ogni cella braille.
|
|
218
|
+
|
|
219
|
+
PT
|
|
220
|
+
Traduz o texto de entrada para uma lista de arrays binários de 6 bits que representam cada célula braille.
|
|
221
|
+
"""
|
|
222
|
+
brailles = self.translate_text_to_braille(text)
|
|
223
|
+
indices = BrailleBase.get_braille_list_to_index_list(brailles)
|
|
224
|
+
binary_lists = BrailleBase.get_binary_list()
|
|
225
|
+
return [binary_lists[i] for i in indices]
|
|
226
|
+
|
|
227
|
+
#0002-E
|
|
228
|
+
def translate_text_to_unicode(self, text: str) -> list:
|
|
229
|
+
"""
|
|
230
|
+
EN
|
|
231
|
+
Translates the input text into a list of Unicode code representations for each braille cell.
|
|
232
|
+
|
|
233
|
+
JP
|
|
234
|
+
入力テキストを、各点字セルの Unicode 表現のリストに変換します。
|
|
235
|
+
|
|
236
|
+
IT
|
|
237
|
+
Traduce il testo di input in una lista di valori Unicode che rappresentano ogni cella braille.
|
|
238
|
+
|
|
239
|
+
PT
|
|
240
|
+
Traduz o texto de entrada para uma lista contendo os valores Unicode que representam cada célula braille.
|
|
241
|
+
"""
|
|
242
|
+
brailles = self.translate_text_to_braille(text)
|
|
243
|
+
indices = BrailleBase.get_braille_list_to_index_list(brailles)
|
|
244
|
+
unicode_lists = BrailleBase.get_unicode_list()
|
|
245
|
+
return [unicode_lists[i] for i in indices]
|
|
246
|
+
|
|
247
|
+
#0002-F
|
|
248
|
+
def translate_text_to_dot_count(self, text: str) -> list:
|
|
249
|
+
"""
|
|
250
|
+
EN
|
|
251
|
+
Translates the input text into a list containing the dot count of each braille cell.
|
|
252
|
+
|
|
253
|
+
JP
|
|
254
|
+
入力テキストを、各点字セルの点の数を表すリストに変換します。
|
|
255
|
+
|
|
256
|
+
IT
|
|
257
|
+
Traduce il testo di input in una lista contenente il numero di punti attivi di ogni cella braille.
|
|
258
|
+
|
|
259
|
+
PT
|
|
260
|
+
Traduz o texto de entrada para uma lista contendo a contagem de pontos de cada célula braille.
|
|
261
|
+
"""
|
|
262
|
+
brailles = self.translate_text_to_braille(text)
|
|
263
|
+
indices = BrailleBase.get_braille_list_to_index_list(brailles)
|
|
264
|
+
dot_count_lists = BrailleBase.get_dot_count()
|
|
265
|
+
return [dot_count_lists[i] for i in indices]
|
|
266
|
+
|
|
267
|
+
#0002-G
|
|
268
|
+
def translate_text_to_numbering_string(self, text: str) -> list:
|
|
269
|
+
"""
|
|
270
|
+
EN
|
|
271
|
+
Translates the input text into a list of numbering strings, each indicating the active dot positions of every braille cell.
|
|
272
|
+
|
|
273
|
+
JP
|
|
274
|
+
入力テキストを、各点字セルのアクティブな点位置を示す番号文字列のリストに変換します。
|
|
275
|
+
|
|
276
|
+
IT
|
|
277
|
+
Traduce il testo di input in una lista di stringhe numeriche che indicano le posizioni dei punti attivi di ogni cella braille.
|
|
278
|
+
|
|
279
|
+
PT
|
|
280
|
+
Traduz o texto de entrada para uma lista de strings numéricas que indicam as posições dos pontos ativos de cada célula braille.
|
|
281
|
+
"""
|
|
282
|
+
brailles = self.translate_text_to_braille(text)
|
|
283
|
+
indices = BrailleBase.get_braille_list_to_index_list(brailles)
|
|
284
|
+
numbering_strings = BrailleBase.get_dot_numbering_string_list()
|
|
285
|
+
return [numbering_strings[i] for i in indices]
|
|
286
|
+
|
|
287
|
+
#0002-H
|
|
288
|
+
def translate_text_to_numbering_list(self, text: str) -> list:
|
|
289
|
+
"""
|
|
290
|
+
EN
|
|
291
|
+
Translates the input text into a list of numbering lists, each containing the active dot positions of every braille cell.
|
|
292
|
+
|
|
293
|
+
JP
|
|
294
|
+
入力テキストを、各点字セルのアクティブな点位置を含む番号リストの一覧に変換します。
|
|
295
|
+
|
|
296
|
+
IT
|
|
297
|
+
Traduce il testo di input in una lista di elenchi numerici che indicano le posizioni dei punti attivi di ogni cella braille.
|
|
298
|
+
|
|
299
|
+
PT
|
|
300
|
+
Traduz o texto de entrada para uma lista de listas numéricas que indicam as posições dos pontos ativos de cada célula braille.
|
|
301
|
+
"""
|
|
302
|
+
brailles = self.translate_text_to_braille(text)
|
|
303
|
+
indices = BrailleBase.get_braille_list_to_index_list(brailles)
|
|
304
|
+
numbering_lists = BrailleBase.get_dot_numbering_list()
|
|
305
|
+
return [numbering_lists[i] for i in indices]
|
|
306
|
+
|
|
307
|
+
#0002-I
|
|
308
|
+
def translate_text_to_full_list(self, text: str) -> list:
|
|
309
|
+
"""
|
|
310
|
+
EN
|
|
311
|
+
Translates the input text into a full list of braille‑related data.
|
|
312
|
+
Each entry contains: braille symbol, index, binary string, binary array, Unicode value, dot count, numbering string, and numbering list.
|
|
313
|
+
|
|
314
|
+
JP
|
|
315
|
+
入力テキストを点字関連データの完全なリストに変換します。
|
|
316
|
+
各要素には、点字記号・インデックス・バイナリ文字列・バイナリ配列・Unicode 値・点の数・番号文字列・番号リストが含まれます。
|
|
317
|
+
|
|
318
|
+
IT
|
|
319
|
+
Traduce il testo di input in un elenco completo di dati relativi al braille.
|
|
320
|
+
Ogni elemento contiene: simbolo braille, indice, stringa binaria, array binario, valore Unicode, numero di punti, stringa numerica e lista numerica.
|
|
321
|
+
|
|
322
|
+
PT
|
|
323
|
+
Traduz o texto de entrada para uma lista completa de dados relacionados ao braille.
|
|
324
|
+
Cada item contém: símbolo braille, índice, string binária, array binário, valor Unicode, contagem de pontos, string de numeração e lista de numeração.
|
|
325
|
+
"""
|
|
326
|
+
brailles = self.translate_text_to_braille(text)
|
|
327
|
+
indices = BrailleBase.get_braille_list_to_index_list(brailles)
|
|
328
|
+
|
|
329
|
+
binary_strings = BrailleBase.get_binary_string_list()
|
|
330
|
+
binary_lists = BrailleBase.get_binary_list()
|
|
331
|
+
unicode_lists = BrailleBase.get_unicode_list()
|
|
332
|
+
dot_count_lists = BrailleBase.get_dot_count()
|
|
333
|
+
numbering_strings = BrailleBase.get_dot_numbering_string_list()
|
|
334
|
+
numbering_lists = BrailleBase.get_dot_numbering_list()
|
|
335
|
+
|
|
336
|
+
result = []
|
|
337
|
+
|
|
338
|
+
for idx in range(len(indices)):
|
|
339
|
+
i = indices[idx]
|
|
340
|
+
result.append([
|
|
341
|
+
brailles[idx],
|
|
342
|
+
i,
|
|
343
|
+
binary_strings[i],
|
|
344
|
+
binary_lists[i],
|
|
345
|
+
unicode_lists[i],
|
|
346
|
+
dot_count_lists[i],
|
|
347
|
+
numbering_strings[i],
|
|
348
|
+
numbering_lists[i]
|
|
349
|
+
])
|
|
350
|
+
return result
|
|
351
|
+
#------------------------------------------------------------------------------------------------------------------------------------
|
|
352
|
+
#0003-A
|
|
353
|
+
@staticmethod
|
|
354
|
+
def get_braille_to_index(braille: str) -> int:
|
|
355
|
+
"""
|
|
356
|
+
EN
|
|
357
|
+
Returns the index associated with the given braille symbol. The mapping follows the standard Unicode braille order (U+2800 to U+283F).
|
|
358
|
+
|
|
359
|
+
JP
|
|
360
|
+
指定した点字記号に対応するインデックスを返します。マッピングは Unicode の点字標準順(U+2800 ~ U+283F)に従います。
|
|
361
|
+
|
|
362
|
+
IT
|
|
363
|
+
Restituisce l’indice associato al simbolo braille indicato. La mappatura segue l’ordine standard Unicode del braille (U+2800–U+283F).
|
|
364
|
+
|
|
365
|
+
PT
|
|
366
|
+
Retorna o índice associado ao símbolo braille informado. O mapeamento segue a ordem padrão Unicode do braille (U+2800 a U+283F).
|
|
367
|
+
"""
|
|
368
|
+
braille_to_index = {
|
|
369
|
+
'⠀': 0, '⠁': 1, '⠂': 2, '⠃': 3, '⠄': 4, '⠅': 5, '⠆': 6, '⠇': 7,
|
|
370
|
+
'⠈': 8, '⠉': 9, '⠊': 10, '⠋': 11, '⠌': 12, '⠍': 13, '⠎': 14, '⠏': 15,
|
|
371
|
+
'⠐': 16, '⠑': 17, '⠒': 18, '⠓': 19, '⠔': 20, '⠕': 21, '⠖': 22, '⠗': 23,
|
|
372
|
+
'⠘': 24, '⠙': 25, '⠚': 26, '⠛': 27, '⠜': 28, '⠝': 29, '⠞': 30, '⠟': 31,
|
|
373
|
+
'⠠': 32, '⠡': 33, '⠢': 34, '⠣': 35, '⠤': 36, '⠥': 37, '⠦': 38, '⠧': 39,
|
|
374
|
+
'⠨': 40, '⠩': 41, '⠪': 42, '⠫': 43, '⠬': 44, '⠭': 45, '⠮': 46, '⠯': 47,
|
|
375
|
+
'⠰': 48, '⠱': 49, '⠲': 50, '⠳': 51, '⠴': 52, '⠵': 53, '⠶': 54, '⠷': 55,
|
|
376
|
+
'⠸': 56, '⠹': 57, '⠺': 58, '⠻': 59, '⠼': 60, '⠽': 61, '⠾': 62, '⠿': 63
|
|
377
|
+
}
|
|
378
|
+
return braille_to_index[braille]
|
|
379
|
+
|
|
380
|
+
#0003-B
|
|
381
|
+
@staticmethod
|
|
382
|
+
def get_braille_list_to_index_list(braille_list: list) -> list:
|
|
383
|
+
"""
|
|
384
|
+
EN
|
|
385
|
+
Converts a list of braille symbols into a list of their corresponding indices.
|
|
386
|
+
|
|
387
|
+
JP
|
|
388
|
+
点字記号のリストを、それぞれに対応するインデックスのリストへ変換します。
|
|
389
|
+
|
|
390
|
+
IT
|
|
391
|
+
Converte una lista di simboli braille in una lista dei rispettivi indici.
|
|
392
|
+
|
|
393
|
+
PT
|
|
394
|
+
Converte uma lista de símbolos braille em uma lista com seus respectivos índices.
|
|
395
|
+
"""
|
|
396
|
+
return [BrailleBase.get_braille_to_index(b) for b in braille_list]
|
|
397
|
+
|
|
398
|
+
#------------------------------------------------------------------------------------------------------------------------------------
|
|
399
|
+
#0004-A
|
|
400
|
+
@staticmethod
|
|
401
|
+
def braille_list():
|
|
402
|
+
"""
|
|
403
|
+
EN
|
|
404
|
+
Returns all braille characters organized in the standard Unicode order, covering the range U+2800 to U+283F.
|
|
405
|
+
JP
|
|
406
|
+
Unicode の標準順(U+2800〜U+283F)に従って並べられた点字文字をすべて返します。
|
|
407
|
+
IT
|
|
408
|
+
Restituisce tutti i caratteri braille organizzati nell’ordine standard Unicode, coprendo l’intervallo da U+2800 a U+283F.
|
|
409
|
+
PT
|
|
410
|
+
Retorna todos os caracteres braille organizados na ordem padrão do Unicode, cobrindo o intervalo de U+2800 a U+283F.
|
|
411
|
+
"""
|
|
412
|
+
return [
|
|
413
|
+
'⠀','⠁','⠂','⠃','⠄','⠅','⠆','⠇',
|
|
414
|
+
'⠈','⠉','⠊','⠋','⠌','⠍','⠎','⠏',
|
|
415
|
+
'⠐','⠑','⠒','⠓','⠔','⠕','⠖','⠗',
|
|
416
|
+
'⠘','⠙','⠚','⠛','⠜','⠝','⠞','⠟',
|
|
417
|
+
'⠠','⠡','⠢','⠣','⠤','⠥','⠦','⠧',
|
|
418
|
+
'⠨','⠩','⠪','⠫','⠬','⠭','⠮','⠯',
|
|
419
|
+
'⠰','⠱','⠲','⠳','⠴','⠵','⠶','⠷',
|
|
420
|
+
'⠸','⠹','⠺','⠻','⠼','⠽','⠾','⠿'
|
|
421
|
+
]
|
|
422
|
+
#0004-B
|
|
423
|
+
@staticmethod
|
|
424
|
+
def get_binary_list():
|
|
425
|
+
|
|
426
|
+
"""
|
|
427
|
+
EN
|
|
428
|
+
Returns a list with 64 items; each item is an array of 6 bits representing a braille character.
|
|
429
|
+
JP
|
|
430
|
+
64 個の項目を持つリストを返します。各項目は、点字文字を表す 6 ビットの配列です。
|
|
431
|
+
IT
|
|
432
|
+
Restituisce una lista con 64 elementi; ogni elemento è un array di 6 bit che rappresenta un carattere braille.
|
|
433
|
+
PT
|
|
434
|
+
Retorna uma lista com 64 itens; cada item é um array de 6 bits que representa um caractere braille.
|
|
435
|
+
"""
|
|
436
|
+
return [
|
|
437
|
+
[int(b) for b in f"{i:06b}"] for i in range(64)
|
|
438
|
+
]
|
|
439
|
+
#0004-C
|
|
440
|
+
@staticmethod
|
|
441
|
+
def get_binary_string_list():
|
|
442
|
+
"""
|
|
443
|
+
EN
|
|
444
|
+
Returns a list with 64 items; each item is a 6‑bit binary string representing a braille character.
|
|
445
|
+
JP
|
|
446
|
+
64 個の項目を持つリストを返します。各項目は、点字文字を表す 6 ビットの文字列です。
|
|
447
|
+
IT
|
|
448
|
+
Restituisce una lista con 64 elementi; ogni elemento è una stringa binaria di 6 bit che rappresenta un carattere braille.
|
|
449
|
+
PT
|
|
450
|
+
Retorna uma lista com 64 itens; cada item é uma string binária de 6 bits que representa um caractere braille.
|
|
451
|
+
"""
|
|
452
|
+
return [f"{i:06b}" for i in range(64)]
|
|
453
|
+
#0004-D
|
|
454
|
+
@staticmethod
|
|
455
|
+
def get_unicode_list():
|
|
456
|
+
"""
|
|
457
|
+
EN
|
|
458
|
+
Returns a list with 64 items; each item is the Unicode code in hexadecimal format corresponding to a braille character.
|
|
459
|
+
JP
|
|
460
|
+
64 個の項目を持つリストを返します。各項目は、点字文字に対応する Unicode の 16 進コードです。
|
|
461
|
+
IT
|
|
462
|
+
Restituisce una lista con 64 elementi; ogni elemento è il codice Unicode in formato esadecimale corrispondente a un carattere braille.
|
|
463
|
+
PT
|
|
464
|
+
Retorna uma lista com 64 itens; cada item é o código Unicode em formato hexadecimal correspondente a um caractere braille.
|
|
465
|
+
"""
|
|
466
|
+
return [f"{0x2800 + i:04x}" for i in range(64)]
|
|
467
|
+
#0004-E
|
|
468
|
+
@staticmethod
|
|
469
|
+
def get_dot_count():
|
|
470
|
+
"""
|
|
471
|
+
EN
|
|
472
|
+
Returns a list with 64 items; each item is an integer indicating how many points are active (1 to 6) in the corresponding braille character.
|
|
473
|
+
JP
|
|
474
|
+
64 個の項目を持つリストを返します。各項目は、対応する点字文字でアクティブな点(1〜6)の数を示す整数です。
|
|
475
|
+
IT
|
|
476
|
+
Restituisce una lista con 64 elementi; ogni elemento è un intero che indica quanti punti (da 1 a 6) sono attivi nel carattere braille corrispondente.
|
|
477
|
+
PT
|
|
478
|
+
Retorna uma lista com 64 itens; cada item é um inteiro indicando quantos pontos estão ativos (1 a 6) no caractere braille correspondente.
|
|
479
|
+
"""
|
|
480
|
+
return [bin(i).count("1") for i in range(64)]
|
|
481
|
+
#0004-F
|
|
482
|
+
@staticmethod
|
|
483
|
+
def get_dot_numbering_list():
|
|
484
|
+
"""
|
|
485
|
+
EN
|
|
486
|
+
Returns a list with 64 items; each item is an array containing the numbers of the active points (1 to 6) of the corresponding braille character. Commonly used in educational materials.
|
|
487
|
+
JP
|
|
488
|
+
64 個の項目を持つリストを返します。各項目は、対応する点字文字でアクティブな点(1〜6)の番号を含む配列です。教育用資料でよく使用されます。
|
|
489
|
+
IT
|
|
490
|
+
Restituisce una lista con 64 elementi; ogni elemento è un array che contiene i numeri dei punti attivi (da 1 a 6) del carattere braille corrispondente. Molto utilizzato in materiali didattici.
|
|
491
|
+
PT
|
|
492
|
+
Retorna uma lista com 64 itens; cada item é um array contendo os números dos pontos ativos (1 a 6) do caractere braille correspondente. Muito usado em materiais didáticos.
|
|
493
|
+
"""
|
|
494
|
+
lst = []
|
|
495
|
+
for i in range(64):
|
|
496
|
+
dots = []
|
|
497
|
+
for d in range(6):
|
|
498
|
+
if (i >> d) & 1:
|
|
499
|
+
dots.append(d+1)
|
|
500
|
+
lst.append(dots)
|
|
501
|
+
return lst
|
|
502
|
+
#0004-G
|
|
503
|
+
@staticmethod
|
|
504
|
+
def get_dot_numbering_string_list():
|
|
505
|
+
"""
|
|
506
|
+
EN
|
|
507
|
+
Returns a list with 64 items; each item is a string containing the numbers of the active points (1 to 6) of the corresponding braille character, separated by hyphens. Commonly used in educational materials.
|
|
508
|
+
JP
|
|
509
|
+
64 個の項目を持つリストを返します。各項目は、対応する点字文字でアクティブな点(1〜6)の番号をハイフンで区切った文字列です。教育用資料でよく使用されます。
|
|
510
|
+
IT
|
|
511
|
+
Restituisce una lista con 64 elementi; ogni elemento è una stringa che contiene i numeri dei punti attivi (da 1 a 6) del carattere braille corrispondente, separati da trattini. Molto utilizzato in materiali didattici.
|
|
512
|
+
PT
|
|
513
|
+
Retorna uma lista com 64 itens; cada item é uma string contendo os números dos pontos ativos (1 a 6) do caractere braille correspondente, separados por hífens. Muito usado em materiais didáticos.
|
|
514
|
+
"""
|
|
515
|
+
return [
|
|
516
|
+
"-".join(str(d) for d in dots)
|
|
517
|
+
for dots in BrailleBase.get_dot_numbering_list()
|
|
518
|
+
]
|
|
519
|
+
|
|
520
|
+
#----------------------------------------------------------------------------------------------------------------------------------------
|
|
521
|
+
#0005-A
|
|
522
|
+
def output_all_json(self, text: str) -> str:
|
|
523
|
+
"""
|
|
524
|
+
EN
|
|
525
|
+
Generates a JSON array containing all braille‑related data for each character in the input text.
|
|
526
|
+
Each entry includes: original letter, braille symbol, index, binary string, binary array, Unicode value, dot count, numbering string, and numbering list.
|
|
527
|
+
|
|
528
|
+
JP
|
|
529
|
+
入力テキスト内の各文字について、点字関連データをすべて含む JSON 配列を生成します。
|
|
530
|
+
各要素には、元の文字・点字記号・インデックス・バイナリ文字列・バイナリ配列・Unicode 値・点の数・番号文字列・番号リストが含まれます。
|
|
531
|
+
|
|
532
|
+
IT
|
|
533
|
+
Genera un array JSON contenente tutti i dati relativi al braille per ogni carattere del testo di input.
|
|
534
|
+
Ogni elemento include: lettera originale, simbolo braille, indice, stringa binaria, array binario, valore Unicode, numero di punti, stringa numerica e lista numerica.
|
|
535
|
+
|
|
536
|
+
PT
|
|
537
|
+
Gera um array JSON contendo todos os dados relacionados ao braille para cada caractere do texto de entrada.
|
|
538
|
+
Cada item inclui: letra original, símbolo braille, índice, string binária, array binário, valor Unicode, contagem de pontos, string de numeração e lista de numeração.
|
|
539
|
+
"""
|
|
540
|
+
import json
|
|
541
|
+
|
|
542
|
+
result = []
|
|
543
|
+
|
|
544
|
+
braille_list = BrailleBase.braille_list()
|
|
545
|
+
binary_strings = BrailleBase.get_binary_string_list()
|
|
546
|
+
binary_lists = BrailleBase.get_binary_list()
|
|
547
|
+
unicode_lists = BrailleBase.get_unicode_list()
|
|
548
|
+
dot_counts = BrailleBase.get_dot_count()
|
|
549
|
+
numbering_strings = BrailleBase.get_dot_numbering_string_list()
|
|
550
|
+
numbering_lists = BrailleBase.get_dot_numbering_list()
|
|
551
|
+
|
|
552
|
+
for ch in text:
|
|
553
|
+
brailles = self.get_brailles_with_letter(ch)
|
|
554
|
+
indices = BrailleBase.get_braille_list_to_index_list(brailles)
|
|
555
|
+
|
|
556
|
+
for idx in indices:
|
|
557
|
+
result.append({
|
|
558
|
+
"letter": ch,
|
|
559
|
+
"braille": braille_list[idx],
|
|
560
|
+
"index": idx,
|
|
561
|
+
"binary_string": binary_strings[idx],
|
|
562
|
+
"binary_list": binary_lists[idx],
|
|
563
|
+
"unicode": unicode_lists[idx],
|
|
564
|
+
"dot_count": dot_counts[idx],
|
|
565
|
+
"numbering_string": numbering_strings[idx],
|
|
566
|
+
"numbering_list": numbering_lists[idx]
|
|
567
|
+
})
|
|
568
|
+
|
|
569
|
+
return json.dumps(result, ensure_ascii=False, indent=4)
|
|
570
|
+
|
|
571
|
+
#0005-B
|
|
572
|
+
def output_all_csv(self, text: str) -> str:
|
|
573
|
+
"""
|
|
574
|
+
EN
|
|
575
|
+
Generates a CSV string containing all braille‑related data for each character in the input text.
|
|
576
|
+
Each row includes: letter, braille symbol, index, binary string, binary array, Unicode value, dot count, numbering string, and numbering list.
|
|
577
|
+
|
|
578
|
+
JP
|
|
579
|
+
入力テキスト内の各文字について、点字関連データをすべて含む CSV 文字列を生成します。
|
|
580
|
+
各行には、元の文字・点字記号・インデックス・バイナリ文字列・バイナリ配列・Unicode 値・点の数・番号文字列・番号リストが含まれます。
|
|
581
|
+
|
|
582
|
+
IT
|
|
583
|
+
Genera una stringa CSV contenente tutti i dati relativi al braille per ogni carattere del testo di input.
|
|
584
|
+
Ogni riga include: lettera originale, simbolo braille, indice, stringa binaria, array binario, valore Unicode, numero di punti, stringa numerica e lista numerica.
|
|
585
|
+
|
|
586
|
+
PT
|
|
587
|
+
Gera uma string CSV contendo todos os dados relacionados ao braille para cada caractere do texto de entrada.
|
|
588
|
+
Cada linha inclui: letra original, símbolo braille, índice, string binária, array binário, valor Unicode, contagem de pontos, string de numeração e lista de numeração.
|
|
589
|
+
"""
|
|
590
|
+
import csv
|
|
591
|
+
import io
|
|
592
|
+
|
|
593
|
+
output = io.StringIO()
|
|
594
|
+
writer = csv.writer(output)
|
|
595
|
+
|
|
596
|
+
writer.writerow([
|
|
597
|
+
"letter",
|
|
598
|
+
"braille",
|
|
599
|
+
"index",
|
|
600
|
+
"binary_string",
|
|
601
|
+
"binary_list",
|
|
602
|
+
"unicode",
|
|
603
|
+
"dot_count",
|
|
604
|
+
"numbering_string",
|
|
605
|
+
"numbering_list"
|
|
606
|
+
])
|
|
607
|
+
|
|
608
|
+
braille_list = BrailleBase.braille_list()
|
|
609
|
+
binary_strings = BrailleBase.get_binary_string_list()
|
|
610
|
+
binary_lists = BrailleBase.get_binary_list()
|
|
611
|
+
unicode_lists = BrailleBase.get_unicode_list()
|
|
612
|
+
dot_counts = BrailleBase.get_dot_count()
|
|
613
|
+
numbering_strings = BrailleBase.get_dot_numbering_string_list()
|
|
614
|
+
numbering_lists = BrailleBase.get_dot_numbering_list()
|
|
615
|
+
|
|
616
|
+
for ch in text:
|
|
617
|
+
brailles = self.get_brailles_with_letter(ch)
|
|
618
|
+
indices = BrailleBase.get_braille_list_to_index_list(brailles)
|
|
619
|
+
|
|
620
|
+
for idx in indices:
|
|
621
|
+
writer.writerow([
|
|
622
|
+
ch,
|
|
623
|
+
braille_list[idx],
|
|
624
|
+
idx,
|
|
625
|
+
binary_strings[idx],
|
|
626
|
+
str(binary_lists[idx]),
|
|
627
|
+
unicode_lists[idx],
|
|
628
|
+
dot_counts[idx],
|
|
629
|
+
numbering_strings[idx],
|
|
630
|
+
str(numbering_lists[idx])
|
|
631
|
+
])
|
|
632
|
+
|
|
633
|
+
return output.getvalue()
|
|
634
|
+
|
|
635
|
+
#0005-C
|
|
636
|
+
def output_all_xml(self, text: str) -> str:
|
|
637
|
+
"""
|
|
638
|
+
EN
|
|
639
|
+
Generates a formatted XML string containing all braille‑related data for each character in the input text.
|
|
640
|
+
Each <item> node includes: letter, braille symbol, index, binary string, binary array, Unicode value, dot count, numbering string, and numbering list.
|
|
641
|
+
|
|
642
|
+
JP
|
|
643
|
+
入力テキスト内の各文字について、点字関連データをすべて含む整形済み XML 文字列を生成します。
|
|
644
|
+
各 <item> ノードには、元の文字・点字記号・インデックス・バイナリ文字列・バイナリ配列・Unicode 値・点の数・番号文字列・番号リストが含まれます。
|
|
645
|
+
|
|
646
|
+
IT
|
|
647
|
+
Genera una stringa XML formattata contenente tutti i dati relativi al braille per ogni carattere del testo di input.
|
|
648
|
+
Ogni nodo <item> include: lettera originale, simbolo braille, indice, stringa binaria, array binario, valore Unicode, numero di punti, stringa numerica e lista numerica.
|
|
649
|
+
|
|
650
|
+
PT
|
|
651
|
+
Gera uma string XML formatada contendo todos os dados relacionados ao braille para cada caractere do texto de entrada.
|
|
652
|
+
Cada nó <item> inclui: letra original, símbolo braille, índice, string binária, array binário, valor Unicode, contagem de pontos, string de numeração e lista de numeração.
|
|
653
|
+
"""
|
|
654
|
+
import xml.etree.ElementTree as ET
|
|
655
|
+
import xml.dom.minidom as minidom
|
|
656
|
+
|
|
657
|
+
root = ET.Element("braille_output")
|
|
658
|
+
|
|
659
|
+
braille_list = BrailleBase.braille_list()
|
|
660
|
+
binary_strings = BrailleBase.get_binary_string_list()
|
|
661
|
+
binary_lists = BrailleBase.get_binary_list()
|
|
662
|
+
unicode_lists = BrailleBase.get_unicode_list()
|
|
663
|
+
dot_counts = BrailleBase.get_dot_count()
|
|
664
|
+
numbering_strings = BrailleBase.get_dot_numbering_string_list()
|
|
665
|
+
numbering_lists = BrailleBase.get_dot_numbering_list()
|
|
666
|
+
|
|
667
|
+
for ch in text:
|
|
668
|
+
brailles = self.get_brailles_with_letter(ch)
|
|
669
|
+
indices = BrailleBase.get_braille_list_to_index_list(brailles)
|
|
670
|
+
|
|
671
|
+
for idx in indices:
|
|
672
|
+
item = ET.SubElement(root, "item")
|
|
673
|
+
|
|
674
|
+
ET.SubElement(item, "letter").text = ch
|
|
675
|
+
ET.SubElement(item, "braille").text = braille_list[idx]
|
|
676
|
+
ET.SubElement(item, "index").text = str(idx)
|
|
677
|
+
ET.SubElement(item, "binary_string").text = binary_strings[idx]
|
|
678
|
+
ET.SubElement(item, "binary_list").text = str(binary_lists[idx])
|
|
679
|
+
ET.SubElement(item, "unicode").text = unicode_lists[idx]
|
|
680
|
+
ET.SubElement(item, "dot_count").text = str(dot_counts[idx])
|
|
681
|
+
ET.SubElement(item, "numbering_string").text = numbering_strings[idx]
|
|
682
|
+
ET.SubElement(item, "numbering_list").text = str(numbering_lists[idx])
|
|
683
|
+
|
|
684
|
+
rough_xml = ET.tostring(root, encoding="utf-8")
|
|
685
|
+
reparsed = minidom.parseString(rough_xml)
|
|
686
|
+
return reparsed.toprettyxml(indent=" ", encoding="utf-8").decode("utf-8")
|
|
687
|
+
|
|
688
|
+
#0005-D
|
|
689
|
+
def output_all_yaml(self, text: str) -> str:
|
|
690
|
+
"""
|
|
691
|
+
EN
|
|
692
|
+
Generates a YAML‑formatted string containing all braille‑related data for each character in the input text.
|
|
693
|
+
Each entry includes: letter, braille symbol, index, binary string, binary array, Unicode value, dot count, numbering string, and numbering list.
|
|
694
|
+
|
|
695
|
+
JP
|
|
696
|
+
入力テキスト内の各文字について、点字関連データをすべて含む YAML 形式の文字列を生成します。
|
|
697
|
+
各項目には、元の文字・点字記号・インデックス・バイナリ文字列・バイナリ配列・Unicode 値・点の数・番号文字列・番号リストが含まれます。
|
|
698
|
+
|
|
699
|
+
IT
|
|
700
|
+
Genera una stringa in formato YAML contenente tutti i dati relativi al braille per ogni carattere del testo di input.
|
|
701
|
+
Ogni voce include: lettera originale, simbolo braille, indice, stringa binaria, array binario, valore Unicode, numero di punti, stringa numerica e lista numerica.
|
|
702
|
+
|
|
703
|
+
PT
|
|
704
|
+
Gera uma string YAML formatada contendo todos os dados relacionados ao braille para cada caractere do texto de entrada.
|
|
705
|
+
Cada item inclui: letra original, símbolo braille, índice, string binária, array binário, valor Unicode, contagem de pontos, string de numeração e lista de numeração.
|
|
706
|
+
"""
|
|
707
|
+
lines = []
|
|
708
|
+
|
|
709
|
+
braille_list = BrailleBase.braille_list()
|
|
710
|
+
binary_strings = BrailleBase.get_binary_string_list()
|
|
711
|
+
binary_lists = BrailleBase.get_binary_list()
|
|
712
|
+
unicode_lists = BrailleBase.get_unicode_list()
|
|
713
|
+
dot_counts = BrailleBase.get_dot_count()
|
|
714
|
+
numbering_strings = BrailleBase.get_dot_numbering_string_list()
|
|
715
|
+
numbering_lists = BrailleBase.get_dot_numbering_list()
|
|
716
|
+
|
|
717
|
+
for ch in text:
|
|
718
|
+
brailles = self.get_brailles_with_letter(ch)
|
|
719
|
+
indices = BrailleBase.get_braille_list_to_index_list(brailles)
|
|
720
|
+
|
|
721
|
+
for idx in indices:
|
|
722
|
+
lines.append(f"- letter: \"{ch}\"")
|
|
723
|
+
lines.append(f" braille: \"{braille_list[idx]}\"")
|
|
724
|
+
lines.append(f" index: {idx}")
|
|
725
|
+
lines.append(f" binary_string: \"{binary_strings[idx]}\"")
|
|
726
|
+
lines.append(f" binary_list: {binary_lists[idx]}")
|
|
727
|
+
lines.append(f" unicode: \"{unicode_lists[idx]}\"")
|
|
728
|
+
lines.append(f" dot_count: {dot_counts[idx]}")
|
|
729
|
+
lines.append(f" numbering_string: \"{numbering_strings[idx]}\"")
|
|
730
|
+
lines.append(f" numbering_list: {numbering_lists[idx]}")
|
|
731
|
+
lines.append("")
|
|
732
|
+
|
|
733
|
+
return "\n".join(lines)
|
|
734
|
+
|
|
735
|
+
#0005-E
|
|
736
|
+
def output_all_markdown(self, text: str) -> str:
|
|
737
|
+
"""
|
|
738
|
+
EN
|
|
739
|
+
Generates a Markdown‑formatted string containing all braille‑related data for each character in the input text.
|
|
740
|
+
Each section includes: braille symbol, index, binary string, binary array, Unicode value, dot count, numbering string, and numbering list.
|
|
741
|
+
|
|
742
|
+
JP
|
|
743
|
+
入力テキスト内の各文字について、点字関連データをすべて含む Markdown 形式の文字列を生成します。
|
|
744
|
+
各セクションには、点字記号・インデックス・バイナリ文字列・バイナリ配列・Unicode 値・点の数・番号文字列・番号リストが含まれます。
|
|
745
|
+
|
|
746
|
+
IT
|
|
747
|
+
Genera una stringa in formato Markdown contenente tutti i dati relativi al braille per ogni carattere del testo di input.
|
|
748
|
+
Ogni sezione include: simbolo braille, indice, stringa binaria, array binario, valore Unicode, numero di punti, stringa numerica e lista numerica.
|
|
749
|
+
|
|
750
|
+
PT
|
|
751
|
+
Gera uma string Markdown formatada contendo todos os dados relacionados ao braille para cada caractere do texto de entrada.
|
|
752
|
+
Cada seção inclui: símbolo braille, índice, string binária, array binário, valor Unicode, contagem de pontos, string de numeração e lista de numeração.
|
|
753
|
+
"""
|
|
754
|
+
lines = []
|
|
755
|
+
|
|
756
|
+
braille_list = BrailleBase.braille_list()
|
|
757
|
+
binary_strings = BrailleBase.get_binary_string_list()
|
|
758
|
+
binary_lists = BrailleBase.get_binary_list()
|
|
759
|
+
unicode_lists = BrailleBase.get_unicode_list()
|
|
760
|
+
dot_counts = BrailleBase.get_dot_count()
|
|
761
|
+
numbering_strings = BrailleBase.get_dot_numbering_string_list()
|
|
762
|
+
numbering_lists = BrailleBase.get_dot_numbering_list()
|
|
763
|
+
|
|
764
|
+
for ch in text:
|
|
765
|
+
brailles = self.get_brailles_with_letter(ch)
|
|
766
|
+
indices = BrailleBase.get_braille_list_to_index_list(brailles)
|
|
767
|
+
|
|
768
|
+
count = 1
|
|
769
|
+
for idx in indices:
|
|
770
|
+
lines.append(f"## {ch} — Braille {count}")
|
|
771
|
+
lines.append(f"- **Braille:** {braille_list[idx]}")
|
|
772
|
+
lines.append(f"- **Index:** {idx}")
|
|
773
|
+
lines.append(f"- **Binary:** `{binary_strings[idx]}`")
|
|
774
|
+
lines.append(f"- **Binary List:** {binary_lists[idx]}")
|
|
775
|
+
lines.append(f"- **Unicode:** {unicode_lists[idx]}")
|
|
776
|
+
lines.append(f"- **Dot Count:** {dot_counts[idx]}")
|
|
777
|
+
lines.append(f"- **Numbering:** {numbering_strings[idx]}")
|
|
778
|
+
lines.append(f"- **Numbering List:** {numbering_lists[idx]}")
|
|
779
|
+
lines.append("")
|
|
780
|
+
count += 1
|
|
781
|
+
|
|
782
|
+
return "\n".join(lines)
|
|
783
|
+
|
|
784
|
+
#0005-F
|
|
785
|
+
def output_all_html(self, text: str) -> str:
|
|
786
|
+
"""
|
|
787
|
+
EN
|
|
788
|
+
Generates an HTML‑formatted string containing all braille‑related data for each character in the input text.
|
|
789
|
+
Each section includes: braille symbol, index, binary string, binary array, Unicode value, dot count, numbering string, and numbering list.
|
|
790
|
+
|
|
791
|
+
JP
|
|
792
|
+
入力テキスト内の各文字について、点字関連データをすべて含む HTML 形式の文字列を生成します。
|
|
793
|
+
各セクションには、点字記号・インデックス・バイナリ文字列・バイナリ配列・Unicode 値・点の数・番号文字列・番号リストが含まれます。
|
|
794
|
+
|
|
795
|
+
IT
|
|
796
|
+
Genera una stringa in formato HTML contenente tutti i dati relativi al braille per ogni carattere del testo di input.
|
|
797
|
+
Ogni sezione include: simbolo braille, indice, stringa binaria, array binario, valore Unicode, numero di punti, stringa numerica e lista numerica.
|
|
798
|
+
|
|
799
|
+
PT
|
|
800
|
+
Gera uma string HTML formatada contendo todos os dados relacionados ao braille para cada caractere do texto de entrada.
|
|
801
|
+
Cada seção inclui: símbolo braille, índice, string binária, array binário, valor Unicode, contagem de pontos, string de numeração e lista de numeração.
|
|
802
|
+
"""
|
|
803
|
+
lines = []
|
|
804
|
+
|
|
805
|
+
lines.append('<div class="braille-output">')
|
|
806
|
+
|
|
807
|
+
braille_list = BrailleBase.braille_list()
|
|
808
|
+
binary_strings = BrailleBase.get_binary_string_list()
|
|
809
|
+
binary_lists = BrailleBase.get_binary_list()
|
|
810
|
+
unicode_lists = BrailleBase.get_unicode_list()
|
|
811
|
+
dot_counts = BrailleBase.get_dot_count()
|
|
812
|
+
numbering_strings = BrailleBase.get_dot_numbering_string_list()
|
|
813
|
+
numbering_lists = BrailleBase.get_dot_numbering_list()
|
|
814
|
+
|
|
815
|
+
for ch in text:
|
|
816
|
+
brailles = self.get_brailles_with_letter(ch)
|
|
817
|
+
indices = BrailleBase.get_braille_list_to_index_list(brailles)
|
|
818
|
+
|
|
819
|
+
count = 1
|
|
820
|
+
for idx in indices:
|
|
821
|
+
lines.append(f' <section class="braille-item">')
|
|
822
|
+
lines.append(f' <h2>{ch} — Braille {count}</h2>')
|
|
823
|
+
lines.append(' <ul>')
|
|
824
|
+
lines.append(f' <li><strong>Braille:</strong> {braille_list[idx]}</li>')
|
|
825
|
+
lines.append(f' <li><strong>Index:</strong> {idx}</li>')
|
|
826
|
+
lines.append(f' <li><strong>Binary:</strong> <code>{binary_strings[idx]}</code></li>')
|
|
827
|
+
lines.append(f' <li><strong>Binary List:</strong> {binary_lists[idx]}</li>')
|
|
828
|
+
lines.append(f' <li><strong>Unicode:</strong> {unicode_lists[idx]}</li>')
|
|
829
|
+
lines.append(f' <li><strong>Dot Count:</strong> {dot_counts[idx]}</li>')
|
|
830
|
+
lines.append(f' <li><strong>Numbering:</strong> {numbering_strings[idx]}</li>')
|
|
831
|
+
lines.append(f' <li><strong>Numbering List:</strong> {numbering_lists[idx]}</li>')
|
|
832
|
+
lines.append(' </ul>')
|
|
833
|
+
lines.append(' </section>')
|
|
834
|
+
count += 1
|
|
835
|
+
|
|
836
|
+
lines.append('</div>')
|
|
837
|
+
|
|
838
|
+
return "\n".join(lines)
|
|
839
|
+
|
|
840
|
+
#0005-GA
|
|
841
|
+
def output_all_txt(self, text: str) -> str:
|
|
842
|
+
"""
|
|
843
|
+
EN
|
|
844
|
+
Generates a plain text string containing all braille‑related data for each character in the input text.
|
|
845
|
+
Each block includes: braille symbol, index, binary string, binary array, Unicode value, dot count, numbering string, and numbering list.
|
|
846
|
+
|
|
847
|
+
JP
|
|
848
|
+
入力テキスト内の各文字について、点字関連データをすべて含むプレーンテキスト文字列を生成します。
|
|
849
|
+
各ブロックには、点字記号・インデックス・バイナリ文字列・バイナリ配列・Unicode 値・点の数・番号文字列・番号リストが含まれます。
|
|
850
|
+
|
|
851
|
+
IT
|
|
852
|
+
Genera una stringa di testo semplice contenente tutti i dati relativi al braille per ogni carattere del testo di input.
|
|
853
|
+
Ogni blocco include: simbolo braille, indice, stringa binaria, array binario, valore Unicode, numero di punti, stringa numerica e lista numerica.
|
|
854
|
+
|
|
855
|
+
PT
|
|
856
|
+
Gera uma string TXT contendo todos os dados relacionados ao braille para cada caractere do texto de entrada.
|
|
857
|
+
Cada bloco inclui: símbolo braille, índice, string binária, array binário, valor Unicode, contagem de pontos, string de numeração e lista de numeração.
|
|
858
|
+
"""
|
|
859
|
+
lines = []
|
|
860
|
+
|
|
861
|
+
braille_list = BrailleBase.braille_list()
|
|
862
|
+
binary_strings = BrailleBase.get_binary_string_list()
|
|
863
|
+
binary_lists = BrailleBase.get_binary_list()
|
|
864
|
+
unicode_lists = BrailleBase.get_unicode_list()
|
|
865
|
+
dot_counts = BrailleBase.get_dot_count()
|
|
866
|
+
numbering_strings = BrailleBase.get_dot_numbering_string_list()
|
|
867
|
+
numbering_lists = BrailleBase.get_dot_numbering_list()
|
|
868
|
+
|
|
869
|
+
for ch in text:
|
|
870
|
+
brailles = self.get_brailles_with_letter(ch)
|
|
871
|
+
indices = BrailleBase.get_braille_list_to_index_list(brailles)
|
|
872
|
+
|
|
873
|
+
count = 1
|
|
874
|
+
for idx in indices:
|
|
875
|
+
lines.append(f"{ch} — Braille {count}")
|
|
876
|
+
lines.append(f"Braille: {braille_list[idx]}")
|
|
877
|
+
lines.append(f"Index: {idx}")
|
|
878
|
+
lines.append(f"Binary: {binary_strings[idx]}")
|
|
879
|
+
lines.append(f"Binary List: {binary_lists[idx]}")
|
|
880
|
+
lines.append(f"Unicode: {unicode_lists[idx]}")
|
|
881
|
+
lines.append(f"Dot Count: {dot_counts[idx]}")
|
|
882
|
+
lines.append(f"Numbering: {numbering_strings[idx]}")
|
|
883
|
+
lines.append(f"Numbering List: {numbering_lists[idx]}")
|
|
884
|
+
lines.append("-" * 40)
|
|
885
|
+
lines.append("")
|
|
886
|
+
count += 1
|
|
887
|
+
|
|
888
|
+
return "\n".join(lines)
|
|
889
|
+
|
|
890
|
+
#0005-GB
|
|
891
|
+
def output_binary_string_txt(self, text: str) -> str:
|
|
892
|
+
"""
|
|
893
|
+
EN
|
|
894
|
+
Generates a plain text string containing only the binary strings of each braille cell derived from the input text.
|
|
895
|
+
|
|
896
|
+
JP
|
|
897
|
+
入力テキストから得られる各点字セルのバイナリ文字列のみを含むプレーンテキスト文字列を生成します。
|
|
898
|
+
|
|
899
|
+
IT
|
|
900
|
+
Genera una stringa di testo contenente solo le stringhe binarie di ogni cella braille derivata dal testo di input.
|
|
901
|
+
|
|
902
|
+
PT
|
|
903
|
+
Gera uma string TXT contendo apenas as binary strings de cada célula braille derivada do texto de entrada.
|
|
904
|
+
"""
|
|
905
|
+
lines = []
|
|
906
|
+
|
|
907
|
+
binary_strings = BrailleBase.get_binary_string_list()
|
|
908
|
+
|
|
909
|
+
for ch in text:
|
|
910
|
+
brailles = self.get_brailles_with_letter(ch)
|
|
911
|
+
indices = BrailleBase.get_braille_list_to_index_list(brailles)
|
|
912
|
+
|
|
913
|
+
for idx in indices:
|
|
914
|
+
lines.append(binary_strings[idx])
|
|
915
|
+
|
|
916
|
+
return "\n".join(lines)
|
|
917
|
+
|
|
918
|
+
#----------------------------Internal logic of exceptions-------------------------------
|
|
919
|
+
def __validate_braille_list(self, braille_list: list):
|
|
920
|
+
"""
|
|
921
|
+
EN
|
|
922
|
+
Internal method that validates a list of braille symbols.
|
|
923
|
+
Ensures the value is a list, that each item is a string, and that every string is a valid Unicode braille character (U+2800–U+283F).
|
|
924
|
+
|
|
925
|
+
JP
|
|
926
|
+
点字記号のリストを検証する内部メソッドです。
|
|
927
|
+
値がリストであること、各要素が文字列であること、そしてすべての文字列が Unicode の有効な点字文字(U+2800~U+283F)であることを確認します。
|
|
928
|
+
|
|
929
|
+
IT
|
|
930
|
+
Metodo interno che convalida una lista di simboli braille.
|
|
931
|
+
Verifica che il valore sia una lista, che ogni elemento sia una stringa e che ogni stringa rappresenti un carattere braille Unicode valido (U+2800–U+283F).
|
|
932
|
+
|
|
933
|
+
PT
|
|
934
|
+
Método interno que valida uma lista de símbolos braille.
|
|
935
|
+
Garante que o valor seja uma lista, que cada item seja uma string e que cada string seja um caractere braille Unicode válido (U+2800–U+283F).
|
|
936
|
+
"""
|
|
937
|
+
if not isinstance(braille_list, list):
|
|
938
|
+
raise TypeError("braille_list must be a list")
|
|
939
|
+
|
|
940
|
+
for b in braille_list:
|
|
941
|
+
if not isinstance(b, str):
|
|
942
|
+
raise TypeError("each braille item must be a string")
|
|
943
|
+
if not ("\u2800" <= b <= "\u283F"):
|
|
944
|
+
raise ValueError(f"invalid braille character: {b}")
|
|
945
|
+
#linguajaponesa = BrailleBase()
|
|
946
|
+
#TESTE 1 OK
|
|
947
|
+
#linguajaponesa.braille_letter_append("ぎ", ["⠂","⠣"])
|
|
948
|
+
#print(linguajaponesa.get_brailles_with_letter("ぎ"))
|
|
949
|
+
|
|
950
|
+
|
|
951
|
+
#TESTE 2
|
|
952
|
+
#a = BrailleBase.get_dot_count()
|
|
953
|
+
#print(a[BrailleBase.get_braille_to_index(linguajaponesa.get_brailles_with_letter("ぎ")[0])])
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: braillebase
|
|
3
|
+
Version: 0.0.4
|
|
4
|
+
Summary: A complete and extensible Unicode Braille processing library.
|
|
5
|
+
Author: Nagao Yuji
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/DukaCrazy/braillebase
|
|
8
|
+
Project-URL: Documentation, https://github.com/DukaCrazy/braillebase
|
|
9
|
+
Project-URL: Source, https://github.com/DukaCrazy/braillebase
|
|
10
|
+
Keywords: braille,unicode,accessibility,API,binary,blind,education
|
|
11
|
+
Requires-Python: >=3.6
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Dynamic: license-file
|
|
15
|
+
|
|
16
|
+
EN
|
|
17
|
+
About the Project
|
|
18
|
+
BrailleBase is a Python library designed to provide a complete, consistent, and extensible foundation for working with Unicode Braille characters (U+2800–U+283F).
|
|
19
|
+
It offers:
|
|
20
|
+
- text‑to‑braille conversion
|
|
21
|
+
- extraction of indices, binary patterns, Unicode values, and dot counts
|
|
22
|
+
- export in multiple formats (JSON, CSV, XML, YAML, Markdown, HTML, TXT)
|
|
23
|
+
- internal validation of braille characters
|
|
24
|
+
- multilingual documentation (EN/JP/IT/PT)
|
|
25
|
+
The goal is to serve as a solid foundation for educational tools, accessibility software, microcontroller projects, serialization systems, and braille‑learning applications.
|
|
26
|
+
|
|
27
|
+
JP
|
|
28
|
+
プロジェクト概要
|
|
29
|
+
BrailleBase は、Unicode 点字文字(U+2800〜U+283F)を扱うための、完全で一貫性があり拡張可能な Python ライブラリです。
|
|
30
|
+
主な機能は次のとおりです:
|
|
31
|
+
- テキストから点字への変換
|
|
32
|
+
- インデックス、バイナリ、Unicode、点の数などの抽出
|
|
33
|
+
- JSON / CSV / XML / YAML / Markdown / HTML / TXT 形式でのエクスポート
|
|
34
|
+
- 点字文字の内部バリデーション
|
|
35
|
+
- 多言語ドキュメント(英語 / 日本語 / イタリア語 / ポルトガル語)
|
|
36
|
+
教育用途、アクセシビリティツール、マイコン制御、シリアライズ処理、点字学習アプリなど、幅広い用途に対応できる基盤を提供します。
|
|
37
|
+
|
|
38
|
+
IT
|
|
39
|
+
Informazioni sul progetto
|
|
40
|
+
BrailleBase è una libreria Python progettata per fornire una base completa, coerente ed estensibile per lavorare con i caratteri Braille Unicode (U+2800–U+283F).
|
|
41
|
+
Offre:
|
|
42
|
+
- conversione da testo a braille
|
|
43
|
+
- estrazione di indici, pattern binari, valori Unicode e numero di punti
|
|
44
|
+
- esportazione in più formati (JSON, CSV, XML, YAML, Markdown, HTML, TXT)
|
|
45
|
+
- validazione interna dei caratteri braille
|
|
46
|
+
- documentazione multilingue (EN/JP/IT/PT)
|
|
47
|
+
L’obiettivo è fornire una base solida per strumenti educativi, software di accessibilità, progetti con microcontrollori, sistemi di serializzazione e applicazioni per l’apprendimento del braille.
|
|
48
|
+
|
|
49
|
+
PT
|
|
50
|
+
Sobre o projeto
|
|
51
|
+
BrailleBase é uma biblioteca Python projetada para fornecer uma base completa, consistente e extensível para manipulação de caracteres Braille Unicode (U+2800–U+283F).
|
|
52
|
+
Ela oferece:
|
|
53
|
+
- conversão de texto para braille
|
|
54
|
+
- extração de índices, binários, Unicode e contagem de pontos
|
|
55
|
+
- exportação em múltiplos formatos (JSON, CSV, XML, YAML, Markdown, HTML, TXT)
|
|
56
|
+
- validação interna de caracteres
|
|
57
|
+
- suporte multilíngue na documentação (EN/JP/IT/PT)
|
|
58
|
+
O objetivo é ser uma fundação sólida para projetos educacionais, acessibilidade, microcontroladores, serialização e ferramentas de estudo de Braille.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
braillebase/__init__.py,sha256=VlNJM7xVOUHeMYw0WdfPhn6JvMn9fZEYHoUQSEHZwg0,46835
|
|
2
|
+
braillebase-0.0.4.dist-info/licenses/LICENSE,sha256=_WEcsoDi10Iry_zl1Phb10FA10aGEh2lzDzh60odFhA,1094
|
|
3
|
+
braillebase-0.0.4.dist-info/METADATA,sha256=4fHsPCUfYjQPX36xJsGxGL65BizErFohNrW_LvdjIwU,3279
|
|
4
|
+
braillebase-0.0.4.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
5
|
+
braillebase-0.0.4.dist-info/top_level.txt,sha256=A7jMFh9QtF7wWe4Q9gWlss4cyiXrlLRDnB2lQKw4VOs,12
|
|
6
|
+
braillebase-0.0.4.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nagao Yuji
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the “Software”), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
braillebase
|