Created
July 19, 2019 15:15
-
-
Save ritvikmath/621188d6de32cc7d3d937f22a631f7a5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| #get the speech which we will try to identify | |
| secret_speech = open('obama_speech_testing.txt', 'r').read() | |
| secret_speech = secret_speech.replace('\n','').replace(' ',' ').lower() | |
| list_of_phrases_secret = secret_speech.split(' ') | |
| #get zipped group of every 3 consecutive words | |
| secret_tups = [str(item) for item in zip(list_of_phrases_secret[:-2], list_of_phrases_secret[1:-1], list_of_phrases_secret[2:])] | |
| #get TF dictionary for the secret speech | |
| d_secret = get_phrase_freq_dict(secret_tups) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment