Skip to content

Commit

Permalink
Update transcribe.js revert
Browse files Browse the repository at this point in the history
  • Loading branch information
stefangrotz authored Nov 24, 2023
1 parent cfb42dc commit fc6a628
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions transcribe.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,28 +99,27 @@ function transcribeEsperantoToPolish(text) {
text = text.replace(new RegExp(override.eo, "g"), override.pl);
}

// Transcribe letter by letter
let transcribedText = "";
for (let char of text) {
if (rules.letters[char]) {
transcribedText += rules.letters[char];
} else {
transcribedText += char; // Keep the character as is if no rule applies
}
}

// Apply fragment replacements
// Apply fragment replacements
for (let fragment of rules.fragments) {
text = text.replace(new RegExp(fragment.match, "g"), fragment.replace);
}

// Apply number replacements with more complex logic
text = text.replace(/\b(\d+)(?:\.(\d+))?\b/g, (match, whole, fraction) => {
whole = parseInt(whole, 10);
fraction = fraction ? parseInt(fraction, 10) : 0;
return transcribeNumber(whole, fraction, rules);
});


// Transcribe letter by letter
let transcribedText = "";
for (let char of text) {
if (rules.letters[char]) {
transcribedText += rules.letters[char];
} else {
transcribedText += char; // Keep the character as is if no rule applies
}
}

return transcribedText;
}
Expand Down

0 comments on commit fc6a628

Please sign in to comment.