Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const conversationHandler = async ({ content }, LanguageProcessor) => {
const context = new ConversationContext()
const { data: sentence } = JSON.parse(content)
logger.info(`Conversation control: received ${content}`)
// Local NLP analysis
logger.info(`NLP Analysis locally for ${content}`)
const localProcessedSentence = await LanguageProcessor.process(
'en',
sentence,
context
)
const { answer, classifications } = localProcessedSentence
const suggestedClassification = extractClassification(classifications)
// Trigger intents
if (suggestedClassification && suggestedClassification !== 'None') {
processIntentType(suggestedClassification, sentence)
if (answer) {