Created
November 12, 2019 07:15
-
-
Save amansrivastava17/f39f9d809827694d7c9a772b30af4efb 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
| sentences = [re.sub(r'.,:?{}', ' ', sentence) for sentence in sentences] | |
| corpus = " ".join(sentences) | |
| words = set(doc.split()) | |
| word_index = {word: index for index, word in enumerate(words)} | |
| with open( 'word_index.json' , 'w' ) as file: | |
| json.dump( word_index , file ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment