我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用argparse.open()。
def __init__(self, codes, separator='@@'): with codecs.open(codes.name, encoding='utf-8') as codes: self.bpe_codes = [tuple(item.split()) for item in codes] # some hacking to deal with duplicates (only consider first instance) self.bpe_codes = dict([(code,i) for (i,code) in reversed(list(enumerate(self.bpe_codes)))]) self.separator = separator