mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Add stripEmojis
This commit is contained in:
parent
b914414fc6
commit
f83435eb07
1 changed files with 6 additions and 1 deletions
|
|
@ -252,6 +252,11 @@ export const htmlToSsmlItems = (
|
|||
return items
|
||||
}
|
||||
|
||||
const stripEmojis = (text: string): string => {
|
||||
const emojiRegex = /[\u{1F600}-\u{1F64F}]/gu
|
||||
return text.replace(emojiRegex, '').replace(/\s+/g, ' ').trim()
|
||||
}
|
||||
|
||||
const textToUtterance = ({
|
||||
tokenizer,
|
||||
idx,
|
||||
|
|
@ -267,7 +272,7 @@ const textToUtterance = ({
|
|||
voice?: string
|
||||
isHtml?: boolean
|
||||
}): Utterance => {
|
||||
const text = textItems.join('')
|
||||
const text = stripEmojis(textItems.join(''))
|
||||
const plainText = isHtml ? htmlToText(text, { wordwrap: false }) : text
|
||||
const wordCount = tokenizer.tokenize(plainText).length
|
||||
return {
|
||||
|
|
|
|||
Loading…
Reference in a new issue