Skip to content

Instantly share code, notes, and snippets.

@mlai-demo
Last active April 18, 2020 18:21
Show Gist options
  • Save mlai-demo/952e4d098069d107c1c2af7d85738d2f to your computer and use it in GitHub Desktop.
Save mlai-demo/952e4d098069d107c1c2af7d85738d2f to your computer and use it in GitHub Desktop.
with open('all_abstracts_lemmas.txt', 'r', encoding = "utf-8") as f:
lemma_text = f.read()
n = 4
word = r'\W*([\w]+)'
text_search_como = re.findall(r'{}\W*{}{}'.format(word*n,'(?:comorbid|comorbidity)',word*n),
lemma_text)
flatten_text_search = [element for sublist in text_search_como for element in sublist
if len(element) >3]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment