Skip to content

Instantly share code, notes, and snippets.

@Jamil
Created December 23, 2016 22:15
Show Gist options
  • Select an option

  • Save Jamil/14123984c07c7a1866c0593ab6a39b00 to your computer and use it in GitHub Desktop.

Select an option

Save Jamil/14123984c07c7a1866c0593ab6a39b00 to your computer and use it in GitHub Desktop.
Create a map of successors, indexed by the predecessor token
bigrammap :: [(String, String)] -> [(String, [String])]
bigrammap bgs = zip leaders followers
where followers = map (\l -> successors l bgs) leaders
leaders = nub $ map fst bgs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment