Created
February 6, 2019 05:26
-
-
Save mohdsanadzakirizvi/b81a65d1dfde36f9ef07e5a1093989ce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
def extract_lemma(doc): | |
parsed_text = {'word':[], 'lemma':[]} | |
for sent in doc.sentences: | |
for wrd in sent.words: | |
#extract text and lemma | |
parsed_text['word'].append(wrd.text) | |
parsed_text['lemma'].append(wrd.lemma) | |
#return a dataframe | |
return pd.DataFrame(parsed_text) | |
extract_lemma(doc) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment