Skip to content

Instantly share code, notes, and snippets.

@HarshSingh16
Created February 8, 2019 07:46
Show Gist options
  • Save HarshSingh16/a5c318611e11a28855ef9f6ba5d59d68 to your computer and use it in GitHub Desktop.
Save HarshSingh16/a5c318611e11a28855ef9f6ba5d59d68 to your computer and use it in GitHub Desktop.
#Creating a dictionary that maps each word to its occurences
#For questions
word2count={}
for sentence in Clean_questions:
for word in sentence.split():
if word not in word2count:
word2count[word]=1
else:
word2count[word]+=1
#For answers
for sentence in Clean_answers:
for word in sentence.split():
if word not in word2count:
word2count[word]=1
else:
word2count[word]+=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment