Last active
October 4, 2020 16:31
-
-
Save abhishek-shrm/fff81d8e4e34a69280cd06fe2873cb9a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# Function for extracting keyphrases | |
def extract_keyphrase(text): | |
# Creating Spacy's Doc object | |
doc=textacy.make_spacy_doc(text,lang=en) | |
# Getting top 5 keyphrases from the text | |
keyphrases=textacy.ke.textrank(doc,normalize='lower',topn=0.33) | |
return [phrase for phrase,score in keyphrases] | |
# Extracting keyphrases for abstracts in validation set | |
df_val['pred_keys']=df_val['abstract'].apply(extract_keyphrase) | |
df_val.head() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment