SitwalaM
first commit
ab89c99
raw
history blame
1.21 kB
import streamlit as st
from dolma.core.utils import split_paragraphs, split_sentences
# Title of the Streamlit app
st.title('Text Splitter: Paragraphs and Sentences')
# Text input from user
sample_text = st.text_area("Paste your text below", height=300)
if sample_text:
# Split the text into paragraphs
paragraphs = split_paragraphs(sample_text)
# Split the text into sentences
sentences = split_sentences(sample_text)
# Show number of paragraphs and sentences
st.write(f"Number of paragraphs: {len(paragraphs)}")
st.write(f"Number of sentences: {len(sentences)}")
# Create two columns for separate views
col1, col2 = st.columns(2)
# Display paragraphs in the left column
with col1:
st.header("Paragraphs")
for i, paragraph in enumerate(paragraphs):
st.subheader(f"Paragraph {i + 1}")
st.write(paragraph.text)
# Display sentences in the right column
with col2:
st.header("Sentences")
for i, sentence in enumerate(sentences):
st.subheader(f"Sentence {i + 1}")
st.write(sentence.text)
else:
st.write("Please paste your text to split it into paragraphs and sentences.")