5 kyu

Romanize Russian Road Signs

Description
Loading description...
Strings
Algorithms
Fundamentals
  • Please sign in or sign up to leave a comment.
  • TanYur Avatar

    Ribs road (Рёбрышки дорога) Expected: 'Ryebryshki doroga', instead got: 'Rebryshki doroga' ????

    ё after consonant letter no vowels

  • Unnamed Avatar

    There are too many cases to catch by random tests. Currently you solution is correct, but the other 3 (including mine) are not. It looks like one of those problems where all combinations can and should be tested, something like:

    describe("all combinations", () => {
      const alphabet = "АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдеёжзийклмнопрстуфхцчшщъыьэюя -";
      const tests = [];
      for (let x of alphabet) {
        tests.push(x);
        for (let y of alphabet)
          tests.push(x + y);
      }
      for (const s of tests) {
        const expected = referenceImplementation(s), actual = romanize(s).replace(/ʼ/g, '’');
        if (actual != expected) {
          Test.assertEquals(actual, expected, `Input: ${s}, expected: ${expected}, actual: ${actual}`);
          return;
        }
      }
      Test.expect(true);
    });
    

    (assertEquals only for failures to avoid too much output.)

    • bdupau Avatar

      Very good point. I should've figured that 200 random cases don't necessarily cover these 68^2 possible combinations. I'll address this soon, by either testing all combinations like you suggest or all relevant types of combinations (e.g. there is no real added value for testing the combination РС).

    • bdupau Avatar

      I added a combination test based on your suggestion.

    • Unnamed Avatar
      Issue marked resolved by Unnamed 7 years ago
  • mn113 Avatar

    You should specify precisely what the Cyrillic vowels are, it's not obvious to an outsider looking at the alphabet.

    • bdupau Avatar

      Hmm I figured people could easily google that. But perhaps I can add a link to this lesson. The part about Consonants and Vowels is pretty clear. Would that suffice, do you think ?

    • mn113 Avatar

      "The consonant letter й is sometimes called a semivowel."

      Pretty clear is not perfectly clear. Why not just be kind and state in the description "The vowels are а, э, ы, у, о, я, е, ё, ю, и"?

      In fact I think this is where I went wrong in my solution, I guessed that й was another vowel.

    • bdupau Avatar

      You are right. The Cyrillic vowels are specified in the description now !

  • Unnamed Avatar

    It looks like ʼ should be preferred in this case: https://en.wikipedia.org/wiki/Apostrophe#Unicode

    U+2019 ’ RIGHT SINGLE QUOTATION MARK Punctuation apostrophe. Serves as both an apostrophe and closing single quotation mark. This is the preferred character to use for apostrophe according to the Unicode standard.

    U+02BC ʼ MODIFIER LETTER APOSTROPHE Modifier letters in Unicode generally are considered part of a word, this is preferred when the apostrophe is considered as a letter in its own right, rather than punctuation that separates letters. Thus this letter apostrophe may be used, for example, in the transliteration of... the Cyrillic "soft sign"... Some consider, though, that this character should be used for the apostrophe in English instead of U+0027 or U+2019. Also ICANN considers U+02BC as a proper character for Ukrainian apostrophe within IDNs...