Skip to main content

A simple Python library

Project description

sololib

一个 Python 工具包,提供多样化的对话语料生成功能。

安装

pip install sololib

功能

语料生成

生成多样化的对话模板,支持中英文混合:

import sololib

# 生成多轮对话
conversation = sololib.get_random_conversation()
# 返回: [("How do I learn Python?", "programming"), ("Can you tell me more?", "programming")]

# 生成单个随机问题
question = sololib.generate_single_question()
# 返回: "What's the best way to learn Django as a beginner?"

# 批量生成问题
questions = sololib.generate_questions(10)
# 返回: 10 个随机问题列表

统计信息

# 获取语料库统计
stats = sololib.get_corpus_stats()
# 返回:
# {
#     "question_templates": {"en": 465, "cn": 117, "total": 582},
#     "followup_templates": {"en": 30, "cn": 10, "total": 40},
#     "estimated_combinations": 1850503,
#     ...
# }

# 估计不重复组合数
combos = sololib.estimate_combinations()  # ~185 万

核心函数

函数 说明
get_random_conversation(n=1) 生成 n 组多轮对话
generate_single_question() 生成单个随机问题
generate_questions(n=10) 批量生成 n 个问题
get_corpus_stats() 获取语料库统计信息
estimate_combinations() 估算不重复组合数

数据规模

  • 英文问题模板: 465 条
  • 中文问题模板: 117 条
  • 追问模板: 40 条
  • 估计组合数: 1,850,503+

覆盖领域:烹饪、编程、健身、旅行、书籍、音乐、宠物、科学、职业、情感等。

开发

# 克隆仓库
git clone https://github.com/iding2959/sololib.git
cd sololib

# 安装开发依赖
uv sync --all-extras --dev

# 运行测试
uv run sololib

License

MIT

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

sololib-0.2.0.tar.gz (20.2 kB view details)

Uploaded Source

Built Distribution

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

sololib-0.2.0-py3-none-any.whl (21.0 kB view details)

Uploaded Python 3

File details

Details for the file sololib-0.2.0.tar.gz.

File metadata

  • Download URL: sololib-0.2.0.tar.gz
  • Upload date:
  • Size: 20.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sololib-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3d74c65f6e7882dec7f2656122530116a2c9d959c1ffd7cecfa4fbcd06765ab7
MD5 d5f21a9ca6872f97c554cfbfe40ccec3
BLAKE2b-256 e44ab0f9829970fd75faa2a8f77dbc5d1b771345b0b7a440f7c6ae99ffdaa428

See more details on using hashes here.

Provenance

The following attestation bundles were made for sololib-0.2.0.tar.gz:

Publisher: sololibpypi.yml on iding2959/sololib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sololib-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: sololib-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 21.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sololib-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ed4a7fb07a06ff4ec09518ece9f9365bba04f596ad5b7af169fdb4bc1c2f2395
MD5 41066c8707833a0a08de6bfaf7199e9b
BLAKE2b-256 2b0eddf292710a44cd51d82c8bd3e8b92366cb6e727e2d3d100ba88da64e2aae

See more details on using hashes here.

Provenance

The following attestation bundles were made for sololib-0.2.0-py3-none-any.whl:

Publisher: sololibpypi.yml on iding2959/sololib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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