Skip to content

Instantly share code, notes, and snippets.

@HarshSingh16
Created February 8, 2019 08:31
Show Gist options
  • Save HarshSingh16/8b5c598e4c006c45ce1e5b562a3d0b23 to your computer and use it in GitHub Desktop.
Save HarshSingh16/8b5c598e4c006c45ce1e5b562a3d0b23 to your computer and use it in GitHub Desktop.
#Creating a dictionary that maps each word to a unique integer and also checking if the frequency threshold is met
threshold=20
questionswordstoint={}
wordnumber=0
for word,count in word2count.items():
if count>=threshold:
questionswordstoint[word]=wordnumber
wordnumber+=1
answersswordstoint={}
wordnumber=0
for word,count in word2count.items():
if count>=threshold:
answersswordstoint[word]=wordnumber
wordnumber+=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment