5 kyu
Japanese Romaji-to-Hiragana Converter
65 of 115ewingsa
Loading description...
Logic
Strings
Parsing
Fundamentals
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
Thanks a lot, this was lots of fun. I also learnt about the Japanese language, double win! :)
hi,
nyo
or one of the two others like it.ん
"char" out of it: wasn't that clear to me when reading the fourth bullet point and you didn't talk about it in the "challenge" part while you reminded us abouttsuSmall
in there. Might be worth of the explicit add in one of those sections.ny[aou]
totally lost me about how to handle those three cases, because of you providing just before they[auo]Small
stuff in the map. Those 3 keys are actually totally useless to solve the task, so I'd recommend to put those three as a note, and not as a part of the "general challenge/task description".All the stuff with nya was just to satisfy Voile, and it is not critical for the overall solution due to its ambuguity. However "gyuunyuu", "ぎゅうにゅう" is tested in the basic tests, which I believe to be sufficient for testing that concatenation.
I am sorry you had trouble finding ん, but 4/5 of my kata is devoted to showing tables of hiragana, and I explicitly say "A map called hiragana with romaji keys and hiragana values, containing everything from the above tables has been provided." And honestly, the map is a convenience for challengers, and if challengers are confused, they can just print it like you did.
nyus are not useless to the task because of the "gyuunyuu" test, but I will move the yaSmall stuff to be a note.
seems you don't understand the reason behind my suggestions. Note that I didn't raise an issue, just a suggestion. Meaning all is working, but the description, for occidental people is somewhat suboptimal. Why not make some small changes to it so that it's easier for "us" to find our way in it? I realized after I posted my previous message that the
n/ん
was effectively in the first table. Where he actually has nothing to do since it's the only entry there that is not consistent with the principle of the table itself (it's in the first line, but does not care about having aa
after it. That doesn't make sense)look at my solution, you'll see that those three keys aren't necessary.
Final note: Are you really down voting the guy who's trying to improvre your kata...? That'd be a nice joke...
I just remembered that romaji representation of hiragana has a specific case of ambiguity due to
ny
, e.gunyu
can be interpreted asうんゆ
(運輸) orうにゅ
(something notable in Touhou). How should it be handled?(I haven't found a standardized way to handle this, and there might be none. But at least for the purpose of this kata, it should only map to a specific, defined output ;-))
Good memory! My test cases already made sure that no
ん
was followed byや
,ゆ
, orよ
, in addition toあ
,い
,う
,え
,お
, andん
. I updated the description to make that explicit.And the only way to handle ambiguity would be to parse a longer string of text and figure out what the word is based on a language model. This is used all the time behind the scenes of machine translation, text-to-speech, part-of-speech analysis, and other natural language processing endeavors. For example, the pronunciation of 'read' (present tense), and 'read' (past tense) cannot be distinguished without context.
On a related note, Chinese and Japanese text needs to be word segmented in order for a language model to even be built, since there are no spaces between words in these languages, and characters can take on different pronunciations and meanings in different contexts. For example,
hito
,人
becomesjin
innihonjin
,日本人
. The basic word segmentation algorithm is to repeatedly iterate over a sentence, and marking the words recognized from largest to smallest. For example,ASMARTTWORD
would start at length 10, not recognizeASMARTWORD
, and eventually recognizeSMART
(and notMART
), thenWORD
, thenA
. If it is not already a kata, I might just make it.Shouldn't apostrophe be used in cases like "んゆ" => "n'yu"?
It is one of the possible solutions, though far from widely used.
Of course there are still other problems with this scheme, specifically with distinguishing long vowels from two short vowels (which macrons are supposed to solve, like
yōkai
, but it's not widely used either). And we haven't even handled the supposed now deprecated kanas yet, which does pop up from time to time. Romaji is never really a fully adequate system.The contracted sounds is also a table, but apparently they aren't inside the map object.
Added the concatenated syllables table to the map instead of just changing the description. It's probably the best design choice.
resolved.
Initial code still has the wrong function name ;-)
Let's just forget that ever happened. ; △ ;