Python-Stop-Words 项目教程

Python-Stop-Words 项目教程

python-stop-wordsGet list of common stop words in various languages in Python项目地址:https://gitcode.com/gh_mirrors/py/python-stop-words

1. 项目的目录结构及介绍

python-stop-words/
├── LICENSE
├── MANIFEST.in
├── README.md
├── setup.py
├── stop_words/
│   ├── __init__.py
│   ├── __pycache__/
│   ├── cache/
│   ├── languages/
│   │   ├── ar.txt
│   │   ├── bg.txt
│   │   ├── ...
│   │   └── zh.txt
│   └── stop_words.py
└── tests/
    ├── __init__.py
    ├── __pycache__/
    └── test_stop_words.py
  • LICENSE: 项目许可证文件。
  • MANIFEST.in: 用于指定在打包时需要包含的非Python文件。
  • README.md: 项目说明文档。
  • setup.py: 项目安装脚本。
  • stop_words/: 核心代码目录。
    • init.py: 模块初始化文件。
    • pycache/: 编译后的字节码文件目录。
    • cache/: 缓存文件目录。
    • languages/: 包含各种语言的停用词文件。
    • stop_words.py: 停用词处理的主要逻辑文件。
  • tests/: 测试代码目录。
    • init.py: 测试模块初始化文件。
    • pycache/: 编译后的字节码文件目录。
    • test_stop_words.py: 停用词处理的测试文件。

2. 项目的启动文件介绍

项目的启动文件主要是 stop_words/stop_words.py,其中包含了获取停用词的主要逻辑。以下是该文件的主要内容:

from .languages import get_language

def get_stop_words(language):
    """
    Get the stop words for the given language.
    """
    return get_language(language)

def safe_get_stop_words(language):
    """
    Safely get the stop words for the given language, returns None if the language is unsupported.
    """
    try:
        return get_stop_words(language)
    except KeyError:
        return None
  • get_stop_words(language): 根据给定的语言获取停用词列表。
  • safe_get_stop_words(language): 安全地获取停用词列表,如果语言不支持则返回 None

3. 项目的配置文件介绍

项目的配置文件主要是 setup.py,用于项目的安装和打包。以下是该文件的主要内容:

from setuptools import setup, find_packages

setup(
    name='stop-words',
    version='2018.7.23',
    description='Get list of common stop words in various languages in Python',
    long_description=open('README.md').read(),
    long_description_content_type='text/markdown',
    url='https://github.com/Alir3z4/python-stop-words',
    author='Alireza Savand',
    author_email='alireza.savand@gmail.com',
    license='BSD',
    packages=find_packages(),
    include_package_data=True,
    install_requires=[],
    classifiers=[
        'Development Status :: 5 - Production/Stable',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: BSD License',
        'Programming Language :: Python :: 2',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.4',
        'Programming Language :: Python :: 3.5',
        'Programming Language :: Python :: 3.6',
        'Programming Language :: Python :: 3.7',
    ],
)
  • name: 项目名称。
  • version: 项目版本。
  • description: 项目描述。
  • long_description: 详细描述,从 README.md 文件中读取。
  • url: 项目仓库地址。
  • author: 作者信息。
  • license: 项目许可证。
  • packages: 包含的包。
  • **

python-stop-wordsGet list of common stop words in various languages in Python项目地址:https://gitcode.com/gh_mirrors/py/python-stop-words

创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

农优影

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值