Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def punc_chinese2english(string):
- """中文标点转英文"""
- chinese_punc = ''.join([ "“", "”", "‘", "’", "。", ",", ";", ":", "?", "!", "—", "~", "(", ")", "《", "》" ])
- english_punc = ''.join(['"', '"', "'", "'", ".", ",", ";", ":", "?", "!", "-", "~", "(", ")", "<", ">" ])
- tran_table = str.maketrans(chinese_punc, english_punc)
- return string.translate(tran_table)
Add Comment
Please, Sign In to add comment