0 Replies - 1476 Views - Last Post: 29 November 2008 - 02:27 AM Rate Topic: -----

#1 yeeeboy82  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 24-October 08

Bigrams

Posted 29 November 2008 - 02:27 AM

I am trying to get bigrams out of a phrase and so far i've got:
b = len(s)
i = 0
d = dict()
k = s[i:i+2]
while i < (b - 1):
if k not in d:
d[k] = 1
i = i + 1
return d

but the loop is not doing the "i=i+1", so all it is doing is printing out the first bigram with '1' next to it.

how can i get all the bigrams in the phrase to show up???

This post has been edited by yeeeboy82: 29 November 2008 - 01:06 PM


Is This A Good Question/Topic? 0
  • +

Page 1 of 1