【转】Python实现的HMM类
#!/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
相关文档:
#---------------------转转转转转转转转转转转转转转转转转转转转转转转-------------------------------------------#
Python作为一种功能强大且通用的编程语言而广受好评,它具有非常清晰的语法特点,适用于多种操作系统,目前在国际上非常流行,正在得到越来越多的应用。
下面就让我们一起来看看它的强大 ......
刚刚写完Python嵌入部分的简单例子(差不多够现在用的啦~),接着看点实际的东西,如果没有这些应用的话,前面的嵌入也没有什么意义。嵌入的其他部分以后遇到再写,不必一下子把那些函数都弄懂,是吧~
OK,来看Python库中我认为最好玩的一部分,也就是Python对网页的操作。
这篇简单说下如何通过网址下载网页,前提当然是 ......
客户给一堆图片要传到后台,图片太大了,上百张图用photoshop改太慢,就想到用python写个简单的批处理。功能简单就是把原图按比例缩小,代码更简单 20多行。
# -*- coding: cp936 -*-
import Image
import glob, os
#图片批处理
def timage():
for files in glob.glob('D:\\1\\*.JPG'):
filepath,filena ......
1、升级系统
yum check-update
yum update
2、安装一些常用的工具
yum install ntp iptraf sysstat screen subversion wget bzip2 nfs-utils vim-common
3、设置每天自动核准时间
# crontab -e
0 * * * * /usr/sbin/ntpdate 210.72.145.44
:wq
4、安装一些开发包
# yum install make gcc gcc-c++ libjpeg-devel ......