Update nlp max length

This commit is contained in:
Richard Roberson 2025-02-13 17:17:29 -07:00
parent 74318174b4
commit 09188ecab2

View file

@ -1,12 +1,14 @@
import { NextRequest, NextResponse } from 'next/server';
import nlp from 'compromise';
const MAX_BLOCK_LENGTH = 300;
const MAX_BLOCK_LENGTH = 450;
const preprocessSentenceForAudio = (text: string): string => {
return text
.replace(/\S*(?:https?:\/\/|www\.)([^\/\s]+)(?:\/\S*)?/gi, '- (link to $1) -')
.replace(/(\w+)-\s+(\w+)/g, '$1$2')
.replace(/(\w+)-\s+(\w+)/g, '$1$2') // Remove hyphenation
// Remove special character *
.replace(/\*/g, '')
.replace(/\s+/g, ' ')
.trim();
};