I want to count the occurrence of the token and for each sentence in a corpus using spacy and append the result for each sentence to a list. Until now the code bellow returns the total number (for the whole corpus) regarding and.
Example/Desired output for 3 sentences : ['1', '0', '2'] Current output : [3]
doc = nlp(corpus)
nb_and = []
for sent in doc.sents:
i = 0
for token in sent:
if token.text == "and":
i += 1
nb_and.append(i)