Source

RomajiPattern / makeRomajiPythonDict.py

#coding:utf8
import sys

kDictionaryName = "convDict"

r = open(sys.argv[1],"r")
w = open(sys.argv[2],"w")
for line in r:
    outputLine = kDictionaryName
    line = line.decode("utf8").strip()
    line = line.split(u",")
    outputLine += '[u"%s"] = ' % (line[0])
    outputLine += '('
    for pattern in line[1:]:
        outputLine += '"%s",' % (pattern)
    outputLine += ')\n'
    print outputLine