Skip to main content

A small package about small basic IO operation when coding

Project description

中文 | English

说明

这是一些NLP/数据工作人员常用的函数组成的包,可以简化一些读写操作,使代码更加可读。主要包括两个部分:基本的读写工具和机器学习/深度学习工作中常用的数据处理函数。

它解决了什么问题:

  • 很多函数是记不住的, 每次写每次都要搜 每次都要问大模型 ,例如pandas排序
  • 刷题的时候,树结构的题目很难调试
nlpertools
 ├── mkdocs.yml # used in doc
 ├── .readthedocs.yml # used in doc
 ├── pyproject.toml # used in pypi
 └── setup.cfg # used in pypi

安装

Install the latest release version

pip install nlpertools

📢[ 推荐 ] 安装git最新版本

pip install git+https://github.com/lvzii/nlpertools

文档

https://nlpertools.readthedocs.io/en/latest/

开发指南

  • import都放在了utils/package.py里,通过脚本可自动生成

  • 类似paddle、ltp的import需要判断是否使用才import,因为import的时间太长,例如:

    class STEM(object):
        from ltp import LTP
    
        def __init__(self, IPT_MODEL_PATH):
            self.ltp = LTP(IPT_MODEL_PATH)
    

    通过pyinstrument判断,超过1s的包即采用这种方式

    • 2s+ happybase、seaborn、torch、jieba
    • 1s+ /
    • 0.5s+ pandas elasticsearch transformers xgboost nltk mongo
  • git commit guide

  • readthedoc 检查文档构建状况

  • 打包发布指南

  • 发布版本需要加tag

开发哲学

针对读取文件的方法,是将一些参数直接写在函数里,以实现快速使用。

原则是:写过一遍的函数,绝不写第二遍!

一些可能需要配置才能用的函数,写上示例

使用示例

import nlpertools

a = nlpertools.readtxt_list_all_strip('res.txt')
# 或
b = nlpertools.io.file.readtxt_list_all_strip('res.txt')
# 生成pypi双因素认证的实时密钥(需要提供key)
python -m nlpertools.get_2fa your_key

## git
python nlpertools.cli --git_push
python nlpertools.cli --git_pull

# 以下功能被nvitop替代,不推荐使用
## 监控gpu显存
python -m nlpertools.monitor.gpu
## 监控cpu
python -m  nlpertools.monitor.memory

一些常用项目

nvitop

ydata-profiling

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nlpertools-1.0.8.tar.gz (62.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nlpertools-1.0.8-py3-none-any.whl (72.0 kB view details)

Uploaded Python 3

File details

Details for the file nlpertools-1.0.8.tar.gz.

File metadata

  • Download URL: nlpertools-1.0.8.tar.gz
  • Upload date:
  • Size: 62.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for nlpertools-1.0.8.tar.gz
Algorithm Hash digest
SHA256 8840d4afa2d47f58e5229c99c6c597d4223bccd1d0685cbfae7b8feeb3e6b678
MD5 c397bca3d833ce162fe964426a36a40d
BLAKE2b-256 22e91fa6f948f622df3699eafafd37698acb27f5f10763c893421b6d1b433b4a

See more details on using hashes here.

File details

Details for the file nlpertools-1.0.8-py3-none-any.whl.

File metadata

  • Download URL: nlpertools-1.0.8-py3-none-any.whl
  • Upload date:
  • Size: 72.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for nlpertools-1.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 9b633c9fab12782fd6bb37b94aa23d1e6205aa0f2bf56f5f0692269d268829d3
MD5 7190e0695986a6386ea1a35103d0dbe3
BLAKE2b-256 a4591fc5674bd7818b6b4bd2d8162e4121e0e48a843e46e18925d100b9c56564

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page