Skip to content

Commit

Permalink
simplify regex for kXHC1983 more
Browse files Browse the repository at this point in the history
  • Loading branch information
tony committed May 28, 2017
1 parent 5031b5d commit 321dd17
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions unihan_etl/expansion.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,12 @@ def expand_kXHC1983(value):
}

for n, loc in enumerate(value[i]['locations']):
lre = re.split(
r'([0-9]{4})\.([0-9]{3})(\*?)', loc
)
lre = re.split(r'([0-9]{4})\.([0-9]{2})([0-9]{1})(\*?)', loc)
value[i]['locations'][n] = {
"page": int(lre[1]),
"position": int(lre[2][0:2]),
"entry": int(lre[2][2]),
"substituted": lre[3] == "*"
"position": int(lre[2]),
"entry": int(lre[3]),
"substituted": lre[4] == "*"
}
return value

Expand Down

0 comments on commit 321dd17

Please sign in to comment.