Created
May 13, 2020 12:20
-
-
Save gauravbansal98/7bd72034397909ed9c3a1ee453e653aa 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
| # convert the loaded descriptions into a vocabulary of words | |
| def to_vocabulary(descriptions): | |
| # build a list of all description strings | |
| all_desc = set() | |
| for key in descriptions.keys(): | |
| [all_desc.update(d.split()) for d in descriptions[key]] | |
| return all_desc | |
| # summarize vocabulary | |
| vocabulary = to_vocabulary(descriptions) | |
| print('Vocabulary Size: %d' % len(vocabulary)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment