Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save Jamil/ec2b20923a475b62a2d20d5271b42f77 to your computer and use it in GitHub Desktop.
Generate a list of potential successor tokens given a word, from a bigram model
successors :: String -> [(String, String)] -> [String]
successors predecessor bigrams = map snd matches
where matches = filter (\p -> fst p == predecessor) bigrams
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment