def word_pairs(text):
 last_word = None
 for word in words(text):
  if (last_word is not None):
   (yield (last_word, word))
  last_word = word
 (yield (last_word, '<end>'))

def word_pairs ( text ) : last_word = None for word in words ( text ) : if ( last_word is not None ) : ( yield ( last_word , word ) ) last_word = word ( yield ( last_word , '<end>' ) )
given some text .