0
Hello, I’m a beginner in Python and I’m working with natural language processing. When processing a text and separating the sentences, I want to write this way in the << SENTENCE >> << SENTENCE >> ... But I don’t know how to do this, I know how to print on screen, but not how to write to the file in this format. If anyone can give me an El thank you very much
import nltk
import nltk.data
arquivo = open('base_setenciado.txt', 'w')
raw_text = open('base.txt').read()
sent_tokenizer=nltk.data.load('tokenizers/punkt/portuguese.pickle')
sentences = sent_tokenizer.tokenize(raw_text)
for sent in sentences[500:505]:
print("<<", sent, ">>\n")