Skip to content

Issue with Narration in Portuguese - Trailing Dots #352

Answered by erew123
arcanjotc asked this question in Q&A
Discussion options

You must be logged in to vote

To do that would be completely custom code to do something like that....

# Remove all newline characters (single or multiple)
cleaned_part = re.sub(r"\n+", " ", cleaned_part)
# New code for replacing periods with dashes
# Split the text into sentences
sentences = re.split(r'(?<=[.!?.。!?])\s+', cleaned_part)
processed_sentences = []
for i, sentence in enumerate(sentences):
    # Remove leading and trailing whitespace
    sentence = sentence.strip()    
    # Remove the period at the end if present
    if sentence.endswith('.'):
        sentence = sentence[:-1]
    # Add a dash before the sentence, but not for the first sentence
    if i > 0:
        sentence = '- ' + sentence
    processed…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@arcanjotc
Comment options

@erew123
Comment options

@arcanjotc
Comment options

@erew123
Comment options

Answer selected by arcanjotc
@arcanjotc
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants