首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >python的Pattern模块

python的Pattern模块

作者头像
py3study
发布2020-01-10 12:21:06
发布2020-01-10 12:21:06
1.2K00
代码可运行
举报
文章被收录于专栏:python3python3
运行总次数:0
代码可运行

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:

代码语言:javascript
代码运行次数:0
运行
复制
> cd pattern-2.4
> python setup.py install 

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

代码语言:javascript
代码运行次数:0
运行
复制
> 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

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2019/08/18 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • pattern
    • Installation
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档