Ejemplo n.º 1
0
def doDisplay(modelFN):
    """Display the content of HMM model stored in modelFN."""

    h = HMM(['a'],['1'])    # A trivial HMM model.
    try:
        with open(modelFN, "r") as M:
            h.loadHMM(M)
            h.dump()
            print ""
            print h.omega_X
            print h.omega_O
    except IOError as (errno, strerror):
          print "I/O error({0}): {1}".format(errno, strerror)
Ejemplo n.º 2
0
def doJudge(modelFN, observationFN):
    """Load model and observation from modelFN and observationFN then make prediction

    Keyword arguments:
        modelFN -- File name to the file where HMM model stored in.
        observationFN -- The name of file that observation sequences stored in."""

    checkEmptyFN(modelFN=modelFN, observation=observationFN)

    h = HMM(['a'],['1'])    # A trivial HMM model.
    obs = ''

    try:
        with open(modelFN, "r") as M:
            h.loadHMM(M)
            if dump:
                h.dump()
    except IOError as (errno, strerror):
          print "I/O error({0}): {1}".format(errno, strerror)