Summarizing Harry Potter With ML

You just converted the audio to text!In order to read the lines from the audio follow this code (don’t forget to change the file’s name):with open(‘new_story.

json’) as file: distros_dict = json.

load(file)for item in distros_dict[‘results’]: print(item[‘alternatives’][0][‘transcript’] +’.

’)Once you have the file as a string you can begin with NLPI used a simple algorithm this time (there are many more complex ones that you can use if you need better accuracy.

e.

g word embedding)StepsConvert paragraphs to sentencesText preprocessing- remove all the special characters, stop words and numbers from all the sentences.

Tokenizing the sentences- get all the words that exist in the sentencesFind weighted frequency of occurrence for each wordReplace words by weighted frequency in the original sentencesSort sentences in descending order of sumThe original text (from the speech-to-text engine):our story today is called the boarded window it was written by Ambrose Bierce here is shop o'neill with the story .

in eighteen thirty only a few miles away from what is now the great city of Cincinnati Ohio.

After preprocessing, tokenizing, and finding the weighted frequency of occurrence for each word.

You should get a score for every sentence:our story today is called the boarded window it was written by Ambrose Bierce here is shop o'neill with the story .

": 2.

818181818181818For the sake of time, I will leave my code (which is self explanatory from here) on my GitHub, and provide you with the results.

 I chose to summarize the story in 4 sentences:he noted how quite to his wife's face look in the deepening darkness he laid his arms upon the table's edge and dropped his face into them .

from what we know about a man like customer lock we may try to imagine some of the details of the story told by my grandfather .

I never saw him these details are it's learned from my grandfather he told me the man's story when I was a boy .

the flash from the rifle hit the room with a clear brightness he saw a huge ears panther tried getting the dead woman toward the window .

“Harry Potter” by J.

K.

 Rowling.

IBM gives you 100 free minutes when you register- and I was running out of mine.

Hence, I chose a short scene from one of the movies of Harry Potter.

If you listen to the original scence you’d notice that it’s quite hard to hear the audio sometimes- hence the misinterpretation of some words.

Harry potter .

he's dead .

from this day for .

you put your faith .

give me .

and now is the time to do that yourself .

come forward to join us .

orthodox .

yeah .

JK .

com .

%HESITATION .

well done drink .

well .

well I must say I'd hoped for the best .

and who might you be %HESITATION Matt .

Neville Longbottom .

I will never lie and sure we can find a place for you in all right let's say something .

%HESITATION well Neville I'm sure we'd all be fascinated to hear what you have to say .

%HESITATION .

doesn't matter how is gone sundown of people die every day .

friends .

family .

%HESITATION %HESITATION will start tonight .

still with us .

here .

so spread .

Remus .

thanks .

all of .

they didn't die in vain .

you will first the first "Following the same steps as above we get the weighted frequency for the words (these are just some of them):{'stupid': 1, 'go': 1, 'Harry': 1, 'potter': 1, 'dead': 1, 'day': 2, 'put': 1, 'faith': 1, 'give': 1, 'wow': 1, 'time': 1, 'come': 1, 'forward': 1, 'join': 1, 'us': 2, 'orthodox': 1, 'yeah': 1, 'JK': 1, 'com': 1, 'well': 4, 'done': 1, 'drink': 1, 'must': 1, 'say': 3, 'hoped': 1, 'best': 1, 'might': 1, 'Matt': 1, 'Neville': 1, 'Longbottom': 1,And for the summary:well Neville I'm sure we'd all be fascinated to hear what you have to say .

I will never lie and sure we can find a place for you in all right let's say something .

well I must say I'd hoped for the best .

doesn't matter how is gone sundown of people die every day .

Looks pretty good considering the fact that I was struggling to understand some of the words myself (you should really look at the scene).

Until next time,Bobcat.

.. More details

Leave a Reply