hmm - #!/usr/bin/env python " HMM module This module...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
#!/usr/bin/env python """ HMM module This module implements simple Hidden Markov Model class. It follows the description in Chapter 6 of Jurafsky and Martin (2008) fairly closely, with one exception: in this implementation, we assume that all states are initial states. @author: Rob Malouf @organization: Dept. of Linguistics, San Diego State University @contact: rmalouf@mail.sdsu.edu @version: 2 @since: 24-March-2008 """ from copy import copy class HMM(object): """ Class for Hidden Markov Models An HMM is a weighted FSA which consists of: - a set of states (0. ..C{self.states}) - an output alphabet (C{self.alphabet}) - a table of state transition probabilities (C{self.A}) - a table of symbol emission probabilities (C{self.B}) - a list of initial probabilies (C{self.initial}) We assume that the HMM is complete, and that all states are both initial and final states. """ def __init__(self,states,alphabet,A,B,initial): """ Create a new FSA object @param states: states @type states: C{list} @param alphabet: output alphabet @type finals: C{list} @param A: transition probabilities
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 4

hmm - #!/usr/bin/env python " HMM module This module...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online