[转]使用python调用计算所分词
发信人: TRAD (GFans), 信区: NLP
标 题: 原创:使用python调用计算所分词
发信站: 水木社区 (Mon Nov 23 13:30:46 2009), 站内
代码很简单,但我自己摸索了一下午,发出来共享一下
把这个文件同ICTALAS30.DLL ,DATA文件夹,Configure.xm l放在同一个目录下即可。
python代码
#coding:gb2312
from ctypes import *
dll=cdll.LoadLibrary("ICTCLAS30.dll")
dll.ICTCLAS_Init(c_char_p("."))
lpText = u"计算所汉语词法分析系统ICTCLAS调用测试"
bSuccess = dll.ICTCLAS_ParagraphProcess(c_char_p(lpText), 1)
print c_char_p(bSuccess).value,lpText
dll.ICTCLAS_Exit()
--
※ 来源:·水木社区 http://newsmth.net·[from: 203.86.35.*]
相关文档:
PEP 0263
Defining Python Source Code Encodings
Python will default to ASCII as standard encoding if no other
encoding hints are given.
To define a source code encoding, a magic comment must
be placed into the source files either as first or second
line in the file, suc ......
2009-11-16
Collin Winter是Python社区一位颇具影响力的开发者,他曾是CPython项目的核心开发者之一、也曾是Unladen Swallow(见文末注释)的核心开发者,参与了很多Python项目的开发。近来传闻Google将在其新项目中限制Python的使用,为此有开发者(以K表示)在Google 论坛中公开询问了Collin Winter,Collin Winte ......
由subprocess创建一个进程,然后进行监视
每一秒钟查看一次,如果正在运行,打印pid和running,如果已停止,,继续执行任务并打印Termined
shell和stdout均设置为False
也许这对做病毒的守护进程很好
#!/usr/bin/env python
import subprocess , sys , time
p=subprocess.Popen(['ping','127.0.0.1','-n','10'], she ......