Skip to content

Instantly share code, notes, and snippets.

@rogerbraun
Created September 12, 2011 01:28
Show Gist options
  • Save rogerbraun/1210412 to your computer and use it in GitHub Desktop.
Save rogerbraun/1210412 to your computer and use it in GitHub Desktop.
Maxixes optimzer
pre_segmented = [["MYDOGISINTHEHOUSE", "MY DOG IS IN THE HOUSE"],
["FOURNICEDOGS", "FOUR NICE DOGS"],
["MYCATLIKESMYDOG", "MY CAT LIKES MY DOG"]]
index = Maxixe::Trainer.generate_corpus_from_io([2,3,4,5], "ILIKEMYDOG
THISHOUSEISMYHOUSE
MYDOGISSONICE
WHOLIKESDOGSANYWAY
CATSANDDOGSUSUALLYFIGHT
INMYHOUSETHEREAREFOURDOGS
IWANTAHOUSEFORMYDOG")
optimal = Maxixe::Trainer.optimize(index, pre_segmented)
# optimal is now {:score => 0, :t => 0.5, :n => ["2","4"]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment