Skip to content

Commit 5f83aa3

Browse files
committed
[REMOVE] the extended set of the morse code
1 parent 37f314c commit 5f83aa3

File tree

1 file changed

+2
-71
lines changed

1 file changed

+2
-71
lines changed

vscode/asperheader/src/modules/morseCode.ts

Lines changed: 2 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -136,75 +136,6 @@ export class MorseTranslator {
136136
'\n': '//' // end of sentence or line
137137
};
138138

139-
/**
140-
* @brief Extended Morse code dictionary for international and special characters
141-
*
142-
* Comprehensive mapping of extended character sets to their Morse Code equivalents.
143-
* Includes:
144-
* - **European Accented Characters**: À, Á, Â, Ä, Ç, É, Ê, Í, Ó, Ô, Õ, Ö, Ú, Ü, ß
145-
* - **Slavic Characters**: Ą, Ć, Č, Ď, Ę, Ě, Ł, Ń, Ň, Ő, Ř, Ś, Š, Ť, Ů, Ű, Ź, Ż, Ž
146-
* - **Cyrillic Alphabet**: Complete Russian alphabet from А to Я including Ё
147-
* - **Japanese Katakana**: Basic katakana characters ア, イ, ウ, エ, オ, カ, キ, ク, ケ, コ
148-
* - **Chinese Characters**: Common Chinese characters 们, 你, 們, 吗, 和, 嗎, 在, 好, 我, 是, 有, 的
149-
* - **Korean Hangul**: Basic Korean characters 가, 나, 다, 라, 마, 바, 사, 아, 자, 차
150-
*
151-
* This extended character set provides broader international support beyond the
152-
* standard ITU-R M.1677-1 specification, enabling Morse code translation for
153-
* multilingual content and international communication scenarios.
154-
*/
155-
private static readonly MORSE_CODE_EXT: Record<string, string> = {
156-
'Á': '.--.-', 'Â': '.-..-', 'Ã': '.-.-', 'Ä': '.-.-',
157-
'Ç': '-.-..', 'É': '..-..', 'Ê': '..--', 'Í': '..---',
158-
'Ó': '---.', 'Ô': '---..', 'Õ': '---.-', 'Ö': '..--',
159-
'Ú': '..--', 'Ü': '..--', 'ß': '...--..', 'Ą': '.--.-',
160-
'Ć': '-.-..', 'Č': '---.', 'Ď': '--..-', 'Ę': '..-..',
161-
'Ě': '.-..-', 'Ğ': '--.', 'İ': '..', 'Ł': '.-..-',
162-
'Ń': '--.--', 'Ň': '--.--', 'Ő': '..--..', 'Ř': '.-.-',
163-
'Ś': '...-...', 'Ş': '...-', 'Š': '...-...', 'Ť': '-..-',
164-
'Ů': '...--', 'Ű': '..--..', 'Ź': '--..-', 'Ż': '--..-.',
165-
'Ž': '--..-.', 'Ё': '.', 'А': '.-', 'Б': '-...',
166-
'В': '.--', 'Г': '--.', 'Д': '-..', 'Е': '.',
167-
'Ж': '...-', 'З': '--..', 'И': '..', 'Й': '.---',
168-
'К': '-.-', 'Л': '.-..', 'М': '--', 'Н': '-.',
169-
'О': '---', 'П': '.--.', 'Р': '.-.', 'С': '...',
170-
'Т': '-', 'У': '..-', 'Ф': '..-.', 'Х': '....',
171-
'Ц': '-.-.', 'Ч': '---.', 'Ш': '----', 'Щ': '--.-',
172-
'Ъ': '--.--', 'Ы': '-.--', 'Ь': '-..-', 'Э': '..-..',
173-
'Ю': '..--', 'Я': '.-.-', 'ア': '.-', 'イ': '..',
174-
'ウ': '..-', 'エ': '.', 'オ': '---', 'カ': '-.-',
175-
'キ': '-.-..', 'ク': '...-', 'ケ': '-.-.-', 'コ': '----',
176-
'们': '--.-', '你': '-.', '們': '--.-', '吗': '..--',
177-
'和': '....-', '嗎': '..--', '在': '.-.', '好': '....',
178-
'我': '.--', '是': '...', '有': '..-.', '的': '-..',
179-
'가': '.-', '나': '-.', '다': '-..', '라': '.-..',
180-
'마': '--', '바': '-...', '사': '...', '아': '.',
181-
'자': '.---', '차': '---.'
182-
};
183-
184-
/**
185-
* @brief Unified Morse code dictionary combining standard and extended character sets
186-
*
187-
* Comprehensive character-to-Morse mapping created by merging the standard
188-
* International Morse Code dictionary (MORSE_CODE) with the extended international
189-
* character set (MORSE_CODE_EXT). This unified dictionary provides complete coverage
190-
* for translation operations while maintaining separation of concerns between
191-
* standard and extended character sets.
192-
*
193-
* Dictionary Composition:
194-
* - **Base Layer**: Standard ITU-R M.1677-1 International Morse Code characters
195-
* - **Extended Layer**: International and special characters overlay
196-
* - **Conflict Resolution**: Extended characters take precedence over base characters
197-
* - **Performance**: Single lookup table for O(1) character translation
198-
*
199-
* Used by both toMorse() and fromMorse() methods as the authoritative character
200-
* mapping source, ensuring consistency across bidirectional translation operations.
201-
*/
202-
private static readonly MERGED_MORSE: Record<string, string> = {
203-
...MorseTranslator.MORSE_CODE,
204-
...MorseTranslator.MORSE_CODE_EXT
205-
};
206-
207-
208139
/**
209140
* @brief Reverse lookup dictionary for Morse code to character translation
210141
*
@@ -216,7 +147,7 @@ export class MorseTranslator {
216147
*/
217148
private static readonly REVERSE_MORSE_CODE: Record<string, string> = (() => {
218149
const rev: Record<string, string> = {};
219-
for (const [char, code] of Object.entries(MorseTranslator.MERGED_MORSE)) {
150+
for (const [char, code] of Object.entries(MorseTranslator.MORSE_CODE)) {
220151
rev[code] = char;
221152
}
222153
return rev;
@@ -251,7 +182,7 @@ export class MorseTranslator {
251182
const final: string = input
252183
.toUpperCase()
253184
.split('')
254-
.map(char => MorseTranslator.MERGED_MORSE[char] ?? '')
185+
.map(char => MorseTranslator.MORSE_CODE[char] ?? '')
255186
.join(' ');
256187
this.log.info(getMessage("morseConverted", input, final));
257188
return final;

0 commit comments

Comments
 (0)