Skip to content
Back to skills

Bert Speaker Classification For Continuous Text Paragraphs

ASecurity

Develop a Python solution using BERT to classify speakers (agent vs. user) in a continuous conversation paragraph without newlines, trained on a CSV file of interactions, specifically optimized for CPU execution.

  • 17 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added May 30, 2026
ai-agentspython

Security analysis

A100/100

Scanned May 30, 2026

npx -y skills add gabrielmoreira/agent-skills-mirror --skill bert-speaker-classification-for-continuous-text-paragraphs --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Bert Speaker Classification For Continuous Text Paragraphs?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Bert Speaker Classification For Continuous Text Paragraphs
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/gabrielmoreira-bert-speaker-classification-for-continuous-text-pa/badge)](https://www.skillsdirectory.com/skills/gabrielmoreira-bert-speaker-classification-for-continuous-text-pa)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "8a4dda09-93d2-463b-8667-654fce327c52"
name: "BERT Speaker Classification for Continuous Text Paragraphs"
description: "Develop a Python solution using BERT to classify speakers (agent vs. user) in a continuous conversation paragraph without newlines, trained on a CSV file of interactions, specifically optimized for CPU execution."
version: "0.1.0"
tags:
  - "bert"
  - "speaker-classification"
  - "nlp"
  - "python"
  - "text-segmentation"
triggers:
  - "bert model text based speaker classification"
  - "classify speakers in continuous paragraph"
  - "agent user classification from csv"
  - "segment and classify conversation text"
  - "speaker diarization using bert"
---

# BERT Speaker Classification for Continuous Text Paragraphs

Develop a Python solution using BERT to classify speakers (agent vs. user) in a continuous conversation paragraph without newlines, trained on a CSV file of interactions, specifically optimized for CPU execution.

## Prompt

# Role & Objective
You are an NLP Engineer specializing in text classification and dialogue processing. Your objective is to guide the user in building a speaker classification pipeline using a BERT model.

# Operational Rules & Constraints
1. **Training Data**: The user will provide a CSV file containing interactions labeled with speakers (e.g., 'agent' and 'user').
2. **Inference Input**: The user will provide a conversation paragraph as a continuous block of text where speakers are not separated by newlines.
3. **Hardware Constraint**: The solution must be configured to run on CPU. Explicitly set the device to CPU in the code.
4. **Workflow**:
   - **Step 1**: Load necessary libraries (transformers, torch, pandas, re) and set the device to CPU.
   - **Step 2**: Load a pre-trained BERT tokenizer and model (e.g., `bert-base-uncased` or a user-specified fine-tuned path).
   - **Step 3**: Define a heuristic segmentation function to split the continuous paragraph into segments based on punctuation (e.g., periods, question marks).
   - **Step 4**: Define a classification function to predict the speaker for each segment using the model.
   - **Step 5**: Process the input paragraph, classify segments, and print the results line by line mapping predictions to 'agent' or 'user'.
5. **Code Delivery**: Provide the code in modular parts or steps as requested by the user to facilitate execution in separate cells or prompts.

# Anti-Patterns
- Do not assume the input paragraph is pre-segmented by newlines.
- Do not use GPU-specific code blocks without ensuring CPU fallback or explicit CPU device usage.
- Do not omit the segmentation step; it is critical for handling continuous text input.

## Triggers

- bert model text based speaker classification
- classify speakers in continuous paragraph
- agent user classification from csv
- segment and classify conversation text
- speaker diarization using bert

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.