计算概论C课程古诗样本、填空、押韵和 AI 点评工具
Project description
cm_poem
古诗样本、填空、押韵和 AI 点评工具。适合在列表、字符串之后做简单互动,也适合文本处理和函数项目阶段做进阶作品。
pip install cm_poem
import cm_poem
poem = cm_poem.random_poem(kind='七言')
print(poem['title'], poem['lines'])
blank = cm_poem.make_blank()
print(blank['question'])
answer = input('请填空:')
if cm_poem.check_answer(answer, blank['answer']):
print('答对了')
else:
print('答案是:', blank['answer'])
print(cm_poem.check_rhyme('黄河入海流', '更上一层楼'))
AI 点评是可选功能,使用时需要学生传入自己的 DeepSeek 或 OpenAI API Key。
import cm_poem
comment = cm_poem.ask_ai_review(
'春风吹过校园路,灯下少年读书声',
api_key='这里填学生自己的 API Key',
provider='deepseek'
)
print(comment)
发布版本不会内置任何 API Key。课堂上建议让学生把 Key 作为函数参数传入,这比设置环境变量更直观。
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cm_poem-1.0.1.tar.gz
(5.3 kB
view details)
File details
Details for the file cm_poem-1.0.1.tar.gz.
File metadata
- Download URL: cm_poem-1.0.1.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6adc98d8da92952d61097da9cc6644ad5afad107815cc21a72306c561d4118e3
|
|
| MD5 |
b625d87bb15d8cbef4a3ad3106e115fe
|
|
| BLAKE2b-256 |
a4b8ccb9c4a8af9d8415f06b4024c74c2a25f850abb30011000a8515daad84e4
|