Agent skill

PyTorch中文文本分类预测脚本编写

编写用于加载词汇表、使用Jieba分词、构建TextDataset类以及执行LSTM模型预测的Python代码。

ECNU-ICALKgithub.com/ECNU-ICALKGitHub ↗
claude-code
Install
npx skills add ECNU-ICALK/AutoSkill --skill pytorch中文文本分类预测脚本编写 --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 1
SKILL.md size: 1 KB
Bundled scripts: none
Version: 0.1.0
Path: SkillBank/ConvSkill/chinese_gpt4_8/pytorch中文文本分类预测脚本编写/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 539
Language: Python

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# PyTorch中文文本分类预测脚本编写 编写用于加载词汇表、使用Jieba分词、构建TextDataset类以及执行LSTM模型预测的Python代码。 ## Prompt # Role & Objective 你是一个Python/PyTorch开发助手。你的任务是根据用户提供的词汇表和模型结构,编写一个完整的文本分类预测脚本。 # Operational Rules & Constraints 1. **词汇表加载**:实现 `load_vocab` 函数,从JSON文件加载词汇表。 2. **分词处理**:使用 `jieba.lcut` 进行中文分词。 3. **文本转索引**:实现 `process_text` 函数,将分词后的列表转换为索引列表。逻辑为:`indices = [vocab[token] if token in vocab else vocab['<UNK>'] for token in tokens]`。 4. **键盘输入**:实现 `get_input_from_keyboard` 函数,提示用户输入文本并返回处理后的索引。 5. **Dataset类**:实现 `TextDataset` 类,继承自 `torch.utils.data.Dataset`。 - `__init__(self, data, vocab)`:接收数据列表和词汇表。 - `__len__(self)`:返回数据长度。 - `__getitem__(self, idx)`:返回 `torch.tensor(self.data[idx], dtype=torch.long)`。 6. **预测流程**:使用 `torch.no_grad()` 进行预测,加载模型权重,并输出预测结果(如好评/差评)。 # Anti-Patterns - 不要假设模型的具体结构(如LSTM参数),除非用户明确提供。 - 不要使用除 `jieba` 以外的分词工具,除非用户指定。 - 不要忽略 `<UNK>` 标记的处理。 ## Triggers - 写一个TextDataset类 - 实现文本分类预测脚本 - 使用jieba分词加载vocab - PyTorch文本预测代码

What's inside
Steps it walks through
  1. Prompt
  2. Triggers
More from AutoSkill
All skills →
About this skill
What does the PyTorch中文文本分类预测脚本编写 skill do?

编写用于加载词汇表、使用Jieba分词、构建TextDataset类以及执行LSTM模型预测的Python代码。

How do I install it?

Run `npx skills add ECNU-ICALK/AutoSkill --skill pytorch中文文本分类预测脚本编写 --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From ECNU-ICALK/AutoSkill, a repository with 539 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going