Skip to content

Instantly share code, notes, and snippets.

@rehrumesh
Created April 14, 2015 07:10
Show Gist options
  • Save rehrumesh/38a8ac0bb639b185faeb to your computer and use it in GitHub Desktop.
Save rehrumesh/38a8ac0bb639b185faeb to your computer and use it in GitHub Desktop.
SCS4011 Lab2 bigramDist
def bigramDist(words,stoplist):
biDist = FreqDist()
uniDist = alphaStopFreqDist(words,stoplist)
for i in range(1, len(words)):
if words[i-1] in uniDist and words[i] in uniDist:
biWord = words[i-1] + ' ' + words[i]
biDist[biWord] += 1
return biDist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment