Created
April 14, 2015 07:10
-
-
Save rehrumesh/38a8ac0bb639b185faeb to your computer and use it in GitHub Desktop.
SCS4011 Lab2 bigramDist
This file contains 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
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