Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>just a quick followup to explain the eventual actual solution we used. Thanks to all who recommended mecab--this appears to have done the trick. </p> <p>We have a mostly-Rails backend, but in our circumstance we didn't need to solve this problem on the backend. For user-entered data, e.g. creating new entities with Japanese names, we modified the UI to require the user to enter the phonetic yomigana in addition to the kanji name. Users seem accustomed to this. The problem was the large corpus of data that is built into the app--hospital, company, and place names, mainly.</p> <p>So, what we did is:</p> <ol> <li>We converted all the source data (a list of 4000 hospitals with name, address, etc) into .csv format (encoded as UTF-8, of course).</li> <li>Then, for developer use, we wrote a ruby script that: <ol> <li>Uses mecab to translate the contents of that file into Japanese phonetic readings (the precise command used was <code>mecab -Oyomi -o seed_hospitals.converted.csv seed_hospitals.csv</code>, which outputs a new file with the kanji replaced by the phonetic equivalent, expressed in full-width katakana).</li> <li>Standardizes all yomikata into hiragana (because users tend to enter hiragana when manually entering yomikata, and hiragana and katakana sort differently). Ruby makes this easy once you find it: <code>NKF.nkf("-h1 -w", katakana_str) # -h1 means to hiragana, -w means output utf8</code></li> <li>Using the awesomely conveninent new Ruby 1.9.2 version of CSV, combine the input file with the mecab-translated file, so that the resulting file now has extra columns inserted, a la NAME, NAME_YOMIGANA, ADDRESS, ADDRESS_YOMIGANA, and so on.</li> </ol></li> <li>Use the data from the resulting .csv file to seed our rails app with its built-in values.</li> </ol> <p>From time to time the client updates the source data, so we will need to do this whenever that happens.</p> <p>As far as I can tell, this output is good. My Japanese isn't good enough to be 100% sure, but a few of my Japanese coworkers skimmed it and said it looks all right. I put a slightly obfuscated sample of the converted addresses in <a href="https://gist.github.com/841752" rel="noreferrer">this gist</a> so that anybody who cared to read this far can see for themselves.</p> <p><strong>UPDATE:</strong> The results are in... it's <em>pretty</em> good, but not perfect. Still, it looks like it correctly phoneticized 95%+ of the quasi-random addresses in my list.</p> <p>Many thanks to all who helped me!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload