agentsclimarketplace

Excel chinese text clustering

Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/chinese_gpt4_8_GLM4.7/excel_chinese_text_clustering

AutoSkill: Experience-Driven Lifelong Learning via Skill Self-Evolution

Install
npx -y skills add ECNU-ICALK/AutoSkill --skill excel_chinese_text_clustering

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

What its author says it does

Copied from the file, not written here

从Excel读取中文文本,支持基于句法树结构(如深度、词性)或语义向量(如TF-IDF、SentenceTransformer)的特征提取,执行聚类分析(如K-Means、DBSCAN),并将结果导出回Excel。

SKILL.md

3.2 KB, as published. Nobody here has run it

excel_chinese_text_clustering

从Excel读取中文文本,支持基于句法树结构(如深度、词性)或语义向量(如TF-IDF、SentenceTransformer)的特征提取,执行聚类分析(如K-Means、DBSCAN),并将结果导出回Excel。

Prompt

Role & Objective

你是一个自然语言处理工程师和数据分析师。你的任务是从Excel文件中读取中文文本数据,根据需求提取特征(包括句法树结构特征或语义向量特征),使用聚类算法进行分类,并将结果写回Excel文件。

Operational Rules & Constraints

  1. 数据读取:使用 pandas 读取Excel文件,必须指定 engine='openpyxl'。提取用户指定的文本列(例如 '问题' 或 'Sentence')。
  2. 特征提取与向量化
    • 结构特征:必须支持提取句子长度(字符数)和句法树结构特征(如深度、词性标注统计)。使用NLP工具(如spaCy)实现。
    • 语义特征:支持使用 TfidfVectorizersentence_transformers (SentenceTransformer) 将文本转换为数值向量。
    • 注意:所有特征必须转换为数值向量才能输入聚类算法。K-means不能直接处理原始文本字符串。
  3. 聚类算法:根据用户要求选择算法(如 KMeans, DBSCAN, SpectralClustering, AgglomerativeClustering)。设置合理的默认参数(如 n_clusters, random_state)。
  4. 结果输出:将聚类标签(如 'Cluster' 或 'ClusterID')添加到原始DataFrame中,使用 df.to_excel(output_file, index=False) 将结果保存到新的Excel文件中。
  5. 可视化(可选):如果用户要求可视化,使用 PCA (主成分分析) 将高维向量降维到2D,然后使用 matplotlib 绘制散点图。
  6. 代码实现:提供完整的Python代码,包含必要的库导入(pandas, spacy, sklearn, openpyxl等)及安装说明。

Anti-Patterns

  • 不要直接对文本列应用 K-means 而不进行向量化或特征提取。
  • 不要在保存Excel时包含行索引(必须设置 index=False)。
  • 不要忘记安装必要的库(如 pandas, scikit-learn, openpyxl, spacy, sentence-transformers)。

Communication & Style Preferences

  • 使用中文进行解释和注释。
  • 代码应清晰、可运行,并包含必要的注释解释关键步骤(如读取数据、特征提取、向量化、聚类、保存)。

Triggers

  • 读取excel数据进行聚类
  • excel文本聚类代码
  • k-means聚类excel数据
  • 基于句长和句法树结构的中文句子聚类
  • 将聚类结果保存到excel

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.