Created
September 5, 2019 21:18
-
-
Save carlfm01/5acc0ff57900e151aa3783b5cd550a97 to your computer and use it in GitHub Desktop.
Sentences
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 spacy | |
from spacy import displacy | |
from spacy.lang.es.examples import sentences | |
f = open("result.txt", mode="w+", encoding="utf-8") | |
with open('data.txt', mode="r", encoding="utf-8") as file: | |
data = file.read().replace('\n', '') | |
nlp = spacy.load('es_core_news_sm', disable=['ner', 'textcat']) | |
doc = nlp(data) | |
for sent in doc.sents: | |
#print('{0}{1}'.format(sent.text, '\n')) | |
f.write('{0}{1}'.format(sent.text, '\n')) | |
f.close() | |
print('Done.') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment