Skip to content

Commit

Permalink
kFenn and kDaeJaweon to regex
Browse files Browse the repository at this point in the history
  • Loading branch information
tony committed May 27, 2017
1 parent bc024bb commit a4f72ad
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions unihan_etl/expansion.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,18 +183,18 @@ def expand_kCihaiT(value):


def expand_kDaeJaweon(value):
vals = value.split('.')
match = re.split(r'([0-9]{4})\.([0-9]{2})([01])', value)
value = {
"page": int(vals[0]),
"position": int(vals[1][0:2]),
"virtual": int(vals[1][2]),
"page": int(match[1]),
"position": int(match[2]),
"virtual": int(match[3]),
}
return value


def expand_kFenn(value):
for i, v in enumerate(value):
vre = re.split(r'(\d+)(\w+)', value[i])
vre = re.split(r'([0-9]+a?)([A-KP*])', value[i])
value[i] = {
"phonetic": int(vre[1]),
"frequency": vre[2]
Expand Down

0 comments on commit a4f72ad

Please sign in to comment.