易截截图软件、单文件、免安装、纯绿色、仅160KB

【转】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中获得某月有多少天的函数

  偶然需要用到这样一个函数,在Delphi中,有现成的函数可以调用!在python中,我找了半天都还没找到,最后自己写了一个函数如下:
def dayOfMonth(date):
if date.month == 12:
return 31
else:
return (date.replace(month=date.month+1, day=1) - datetime.timedelta(days=1)).day
......

python PIL 批量处理处理图片

客户给一堆图片要传到后台,图片太大了,上百张图用photoshop改太慢,就想到用python写个简单的批处理。功能简单就是把原图按比例缩小,代码更简单 20多行。
# -*- coding: cp936 -*-
import Image
import glob, os
#图片批处理
def timage():
for files in glob.glob('D:\\1\\*.JPG'):
filepath,filena ......

Python 定时运行脚本

import sys
import os
import datetime
import time
class ArgsDealwith:
   
    def arg_environment(self, args):
        filepath = ('PYTHON_PATH', 'path')
        for i in filepath:
 &nbs ......

Python笔记(10)

Python中的异常
 
当你的程序中出现某些异常的状况的时候,异常就发生了。
 
一.处理异常
我们可以使用try..except语句来处理异常。我们把通常的语句放在try-块中,而把我们的错误处理语句放在except-块中。
例如:
#!/usr/bin/python
# Filename: try_except.py
import sys
try:
s = raw_input('E ......

linux上安装python服务器相关工具


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 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号