Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

313
Views
integrar node-telegram-bot-api con nlp.js QnA

Estoy creando un bot de Telegram. Quiero integrar nlp.js para tener un QnA. Por el momento tengo este código:

 #!/usr/bin/env node const TelegramBot = require('node-telegram-bot-api'); const process = require('process'); const path = require('path'); const { dockStart } = require('@nlpjs/basic'); const axios = require('axios').default; //const qnaFile = path.dirname() let chatId; let currentUser; let incomingMessage; let response; let dock; let nlp; // replace the value below with the Telegram token you receive from @BotFather const token = process.env.TELEGRAM_BOT_TOKEN || '5252802474:AA'; // Create a bot that uses 'polling' to fetch new updates const bot = new TelegramBot(token, {polling: true}); bot.onText(/\/echo(.+)/, async (msg, match) => { // 'msg' is the received Message from Telegram // 'match' is the result of executing the regexp above on the text content // of the message //const chatId = msg.chat.id; console.log(`CONSOLE LOG onText: \n ${match, msg}`); }); bot.on('message', async (msg) => { chatId = msg.chat.id; currentUser = msg.from.first_name; incomingMessage = msg.text; dock = await dockStart(); const nlp = await dock.get('nlp'); await nlp.train(); response = await nlp.process('en', incomingMessage); // Listen for any kind of message. There are different kinds of messages. console.log(response); console.log(msg); // send a message to the chat acknowledging receipt of their message await bot.sendMessage(chatId, `${response.answer}`); });

¿Cómo puedo agregar nuevas intenciones y expresiones utilizando los mensajes entrantes de entrada del usuario? ¿De la documentación de la biblioteca no veo ninguna referencia sobre la actualización dinámica del archivo de corpus?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!