Update nlp max length
This commit is contained in:
parent
74318174b4
commit
09188ecab2
1 changed files with 4 additions and 2 deletions
|
|
@ -1,12 +1,14 @@
|
||||||
import { NextRequest, NextResponse } from 'next/server';
|
import { NextRequest, NextResponse } from 'next/server';
|
||||||
import nlp from 'compromise';
|
import nlp from 'compromise';
|
||||||
|
|
||||||
const MAX_BLOCK_LENGTH = 300;
|
const MAX_BLOCK_LENGTH = 450;
|
||||||
|
|
||||||
const preprocessSentenceForAudio = (text: string): string => {
|
const preprocessSentenceForAudio = (text: string): string => {
|
||||||
return text
|
return text
|
||||||
.replace(/\S*(?:https?:\/\/|www\.)([^\/\s]+)(?:\/\S*)?/gi, '- (link to $1) -')
|
.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, ' ')
|
.replace(/\s+/g, ' ')
|
||||||
.trim();
|
.trim();
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue