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
import spacy | |
nlp = spacy.load('en_core_web_md') | |
def compound_to_simple(sentence): | |
doc = nlp(sentence) | |
root_token = None | |
for token in doc: | |
if (token.dep_ == "ROOT"): | |
root_token = token |
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
import spacy | |
import coreferee | |
def coref_resolve(text): | |
nlp1 = spacy.load('en_core_web_trf') | |
nlp1.add_pipe('coreferee') | |
doc1 = nlp1(text) | |
tok_list = list(token.text for token in doc1) | |
c = 0 | |
for chain in doc1._.coref_chains: |