Skip to content

Instantly share code, notes, and snippets.

@Everfighting
Created November 6, 2020 06:27
Show Gist options
  • Save Everfighting/f8164e6801f24b0c284a2a8702b360af to your computer and use it in GitHub Desktop.
Save Everfighting/f8164e6801f24b0c284a2a8702b360af to your computer and use it in GitHub Desktop.
from itertools import groupby
sep = ',!?:; :,.。!?《》、|\\/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
eng_split_texts = [''.join(g) for k, g in groupby(self.eng_texts, sep.__contains__) if not k]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment