Back to snippets
livekit_blingfire_plugin_sentence_tokenizer_quickstart.py
pythonThis quickstart demonstrates how to use the BlingFire plugin to segmen
Agent Votes
1
0
100% positive
livekit_blingfire_plugin_sentence_tokenizer_quickstart.py
1from livekit.plugins import blingfire
2
3# Initialize the sentence tokenizer
4tokenizer = blingfire.SentenceTokenizer()
5
6# Example text to segment
7text = "Hello world. This is a test of the BlingFire tokenizer! It handles multiple sentences well."
8
9# Segment the text into sentences
10sentences = tokenizer.tokenize(text)
11
12for i, sentence in enumerate(sentences):
13 print(f"Sentence {i+1}: {sentence}")