1910 次
1 に答える
2
You'll have to decompose the Korean syllables and store these into a separate column in your SQL db (like ㅈㅓㅇㅅㅜㅇㅕㄴ for 정수연). I'd suggest you write a small custom app that parses your db, decomposes all Korean syllables, and saves the results into a separate column.
EDIT
Here's some Python code that will decompose Hangul syllables:
#!/usr/local/bin/python
# -*- coding: utf8 -*-
import codecs, sys, os, math
JLT="ㄱ,ㄲ,ㄴ,ㄷ,ㄸ,ㄹ,ㅁ,ㅂ,ㅃ,ㅅ,ㅆ,ㅇ,ㅈ,ㅉ,ㅊ,ㅋ,ㅌ,ㅍ,ㅎ".split(",")
JTT=",ㄱ,ㄲ,ㄱㅅ,ㄴ,ㄴㅈ,ㄴㅎ,ㄷ,ㄹ,ㄹㄱ,ㄹㅁ,ㄹㅂ,ㄹㅅ,ㄹㅌ,ㄹㅍ,ㄹㅎ,ㅁ,ㅂ,ㅂㅅ,ㅅ,ㅆ,ㅇ,ㅈ,ㅊ,ㅋ,ㅌ,ㅍ,ㅎ".split(",")
JVT="ㅏ,ㅐ,ㅑ,ㅒ,ㅓ,ㅔ,ㅕ,ㅖ,ㅗ,ㅘ,ㅙ,ㅚ,ㅛ,ㅜ,ㅝ,ㅞ,ㅟ,ㅠ,ㅡ,ㅢ,ㅣ".split(",")
SBase=0xAC00
SCount=11172
TCount=28
NCount=588
def HangulName(a):
b=a.decode('utf8')
sound=''
for i in b:
cp=ord(i)
SIndex = cp - SBase
if (0 > SIndex or SIndex >= SCount):
# "Not a Hangul Syllable"
pass
LIndex = int(math.floor(SIndex / NCount))
VIndex = int(math.floor((SIndex % NCount) / TCount))
TIndex = int(SIndex % TCount)
sound=sound+(JLT[LIndex] + JVT[VIndex] + JTT[TIndex]).lower()
return sound
print HangulName("정수연")
dda$ python test.py
ㅈㅓㅇㅅㅜㅇㅕㄴ
于 2012-10-07T03:48:05.093 に答える