python的Pattern模块

Pattern是一个用于Python编程语言的网络挖掘模块,集成了多种工具,包括数据检索(如Google、Twitter、Wikipedia API)、网页爬虫、HTML解析、文本分析(基于规则的浅析器、WordNet接口等)、聚类及分类算法(如K-means、KNN、SVM)以及数据可视化。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

pattern

Pattern is a web mining module for the Python programming language.

It bundles tools for data retrieval (Google + Twitter + Wikipedia API, web spider, HTML DOM parser), text analysis (rule-based shallow parser, WordNet interface, syntactical + semantical n-gram search algorithm, tf-idf + cosine similarity + LSA metrics), clustering and classification (k-means, KNN, SVM), and data visualization (graph networks).

The module is bundled with 30+ example scripts and 350+ unit tests.



Installation

Pattern is written for Python 2.5+ (no support for Python 3 yet). The module has no external dependencies except when using LSA in the vector module, which requires NumPy (installed by default on Mac OS X).

To install it so that the module is available in all your scripts, open a terminal and do:

> cd pattern-2.4
> python setup.py install 

If you have pip, you can automatically download and install from the PyPi repository:

> pip install pattern

If none of the above works, you can make Python aware of the module in three ways:

  • Put the pattern subfolder in the same folder as your script.
  • Put the pattern subfolder in the standard location for modules so it is available to all scripts:
    c:\python25\Lib\site-packages\ (Windows),
    /Library/Python/2.5/site-packages/ (Mac OS X),

    /usr/lib/python2.5/site-packages/ (Unix).
  • Add the location of the module to sys.path in your script, before importing it:
>>> MODULE = '/users/tom/desktop/pattern'
>>> import sys; if MODULE not in sys.path: sys.path.append(MODULE)
>>> from pattern.en import parse, Sentence

 


评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值