Yoctol / strpipe

text preprocessing pipeline
Other
5 stars 0 forks source link

[BUG]: index2token change after serialization #52

Closed SoluMilken closed 5 years ago

stegben commented 5 years ago

Could you be more clear about the purpose of this bug? What happened when serializing?

SoluMilken commented 5 years ago

The key of dictionary would be transformed into string type when json.dump.

import json
A = {0: '0', 1: '1'}  # key: int, value: str
with open('789.json', 'w') as filep: 
    json.dump(A, filep, ensure_ascii=False)
def filep
with open('789.json', 'r') as filep: 
    B = json.load(filep)
print(B)  # returns {'0': '0', '1': '1'} key: str, value: str
A == B  # returns False
stegben commented 5 years ago

please squash the last two commits