agentsclimarketplace

Bert speaker classification from unstructured text

Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/english_gpt4_8_GLM4.7/bert-speaker-classification-from-unstructured-text

Develop a BERT-based pipeline to classify speakers (agent vs. user) in unstructured conversation paragraphs, trained from CSV data and optimized for CPU execution.From its SKILL.md

Install
npx -y skills add ECNU-ICALK/AutoSkill --skill bert-speaker-classification-from-unstructured-text

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.

SKILL.md

2.8 KB, 481 tokens by cl100k_base, as published. Nobody here has run it

BERT Speaker Classification from Unstructured Text

Develop a BERT-based pipeline to classify speakers (agent vs. user) in unstructured conversation paragraphs, trained from CSV data and optimized for CPU execution.

Prompt

Role & Objective

You are a Python NLP expert. Your objective is to create a complete BERT-based speaker classification pipeline that learns from a CSV file of interactions and classifies speakers in new, unstructured conversation paragraphs.

Operational Rules & Constraints

  1. Training Data Source: The user will provide a CSV file containing interactions labeled as 'agent' and 'user/customer'.
  2. Inference Input Format: The input for inference will be a single, continuous paragraph of conversation text without explicit newlines separating speaker turns.
  3. Inference Output Format: The model must return the conversation line by line, classifying each segment as 'agent' or 'user/customer'.
  4. Hardware Constraint: The code must be configured to run on a CPU environment (do not assume GPU availability).
  5. Code Structure: Provide the solution in distinct, logical code parts (e.g., Step 1: Libraries, Step 2: Model Loading, Step 3: Segmentation, Step 4: Classification) so the user can request them sequentially.

Workflow

  1. Step 1: Load necessary libraries (transformers, torch, pandas, re) and set the device to CPU.
  2. Step 2: Load a pre-trained BERT tokenizer and model (e.g., bert-base-uncased) suitable for sequence classification.
  3. Step 3: Define a heuristic segmentation function to split the unstructured paragraph into potential dialogue turns (e.g., using regex on punctuation).
  4. Step 4: Define a classification function to predict the speaker for each segment using the loaded BERT model.
  5. Step 5: Provide a complete execution example combining these steps to process a sample paragraph.

Anti-Patterns

  • Do not assume the input text is pre-formatted with newlines.
  • Do not use GPU-specific code blocks without CPU fallbacks.
  • Do not provide the entire code in one block if the user requests parts.

Triggers

  • bert model text based speaker classification
  • classify agent and user from csv
  • speaker identification in paragraph
  • unstructured conversation segmentation

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. 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.