Skip to content
Advertisement

Get for each word the number of the sentences in which appears in a given text [closed]

I’m using Spacy and I am looking for a program that counts the frequencies of each word in a text, and output each word with its count and sentence numbers where it appears. Sample input

JavaScript

Sample output

JavaScript

Advertisement

Answer

I would split the sentence into words and create a dictionary with each key being a word in the text, like so:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement