Skip to content

Commit

Permalink
Update nlp max length
Browse files Browse the repository at this point in the history
  • Loading branch information
richardr1126 committed Feb 14, 2025
1 parent 7431817 commit 09188ec
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/app/api/nlp/route.ts
Original file line number Diff line number Diff line change
@@ -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();
};
Expand Down

0 comments on commit 09188ec

Please # to comment.