krinlove commited on
Commit
401eebd
·
verified ·
1 Parent(s): 4dc569b

Update src/lib/utils/index.ts

Browse files
Files changed (1) hide show
  1. src/lib/utils/index.ts +2 -1
src/lib/utils/index.ts CHANGED
@@ -508,7 +508,8 @@ export const removeEmojis = (str) => {
508
 
509
  export const extractSentences = (text) => {
510
  // Split the paragraph into sentences based on common punctuation marks
511
- const sentences = text.split(/(?<=[.!?])\s+/);
 
512
 
513
  return sentences
514
  .map((sentence) => removeEmojis(sentence.trim()))
 
508
 
509
  export const extractSentences = (text) => {
510
  // Split the paragraph into sentences based on common punctuation marks
511
+ // const sentences = text.split(/(?<=[.!?])\s+/);
512
+ const sentences = text.match(/[^.?!]+[.!?]+[\])'"`’”]*|.+/g);//解决ios正则表达式的问题
513
 
514
  return sentences
515
  .map((sentence) => removeEmojis(sentence.trim()))