{"id":22245496,"url":"https://github.com/morgbn/mcb","last_synced_at":"2026-04-24T20:36:10.803Z","repository":{"id":64716923,"uuid":"575012774","full_name":"Morgbn/mcb","owner":"Morgbn","description":"Lightweight multi-language nodejs/browser chatbot","archived":false,"fork":false,"pushed_at":"2022-12-13T15:14:47.000Z","size":190,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-29T01:38:54.880Z","etag":null,"topics":["bot","browser","chatbot","chatbots","javascript","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Morgbn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-12-06T15:03:42.000Z","updated_at":"2022-12-13T09:41:10.000Z","dependencies_parsed_at":"2022-12-14T13:04:54.784Z","dependency_job_id":null,"html_url":"https://github.com/Morgbn/mcb","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/Morgbn/mcb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Morgbn%2Fmcb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Morgbn%2Fmcb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Morgbn%2Fmcb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Morgbn%2Fmcb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Morgbn","download_url":"https://codeload.github.com/Morgbn/mcb/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Morgbn%2Fmcb/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259750670,"owners_count":22905933,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bot","browser","chatbot","chatbots","javascript","nodejs"],"created_at":"2024-12-03T05:16:05.344Z","updated_at":"2026-04-24T20:36:10.759Z","avatar_url":"https://github.com/Morgbn.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MCB: Mini Chat Bot 🤖💬\n\n[![size](https://img.shields.io/bundlephobia/min/mcb?style=for-the-badge)](https://bundlephobia.com/result?p=mcb)\n[![beta](https://img.shields.io/badge/BETA-test-red?style=for-the-badge)](#)\n[![usejs](https://img.shields.io/badge/USES-JS-yellow?style=for-the-badge)](#)\n[![tested with jest](https://img.shields.io/badge/tested_with-jest-99424f.svg?logo=jest\u0026style=for-the-badge)](https://github.com/facebook/jest)\n\n---\n\nMCB is a text processor for nodejs/browser chatbot. The goal is to be lightweight and in theory usable with any language.\n\n## Install\n\n```\n$ npm i mcb\n```\n\n## Usage\n\n```js\nimport { MCB } from 'mcb'\n\n// \"Training\" data\nconst data = [{\n  intent: 'greetings.bye',\n  utterances: ['goodbye for now', 'bye bye take care', 'okay see you later', 'bye for now', 'i must go'],\n  answers: ['Till next time', 'See you soon!']\n}, {\n  intent: 'greetings.hello',\n  utterances: ['hello', 'hi', 'howdy'],\n  answers: ['Hey there!', 'Greetings!']\n}]\n\nconst bot = new MCB({ data })\nconsole.log(bot.process('goodbye for now').answer)\n// =\u003e \"Till next time\" or \"See you soon!\"\n```\n\n### Slot filling\n\nExample code for slot filling:\n\n```js\nimport { MCB, btwEntity } from 'mcb'\n\nconst data = [{\n  intent: 'travel.start',\n  utterances: ['I want to travel'],\n  answers: ['Where do you want to go?']\n}, {\n  intent: 'travelTo',\n  utterances: ['to @city'],\n  answers: ['From where you are traveling?'],\n  cond: d =\u003e d.lastStep === 'travel.start'\n}, {\n  intent: 'travelFrom',\n  utterances: ['from @city'],\n  answers: ['When do you want to travel?'],\n  cond: d =\u003e d.lastStep === 'travelTo'\n}, {\n  intent: 'travelDate',\n  utterances: ['tomorrow', 'the @date'],\n  answers: [d =\u003e `You want to travel from ${d.history.travelTo.city_val} to ${d.history.travelFrom.city_val} the ${new Date(d.date_val).toLocaleDateString('en-US')}`],\n  cond: d =\u003e d.lastStep === 'travelFrom'\n}, {\n  intent: 'travalOneShot',\n  utterances: ['I want to travel from @fromCity to @toCity at @date', 'I want to travel to @toCity from @fromCity at @date'],\n  answers: [d =\u003e `You want to travel from ${d.fromCity_val} to ${d.toCity_val} the ${new Date(d.date_val).toLocaleDateString('en-US')}`]\n}]\n\nconst entities = {\n  date: /(\\d{4}-\\d{2}-\\d{2}|\\d{2}\\/\\d{2}\\/\\d{4})/gi,\n  city: /(?:[\\p{Letter}\\p{Mark}]+(?:. |-| |'))*[\\p{Letter}\\p{Mark}]+/gu,\n  fromCity: btwEntity('fromCity', ['from'], [' to ', ' the ', ' at ']),\n  toCity: btwEntity('toCity', ['to'], [' from ', ' the ', ' at '])\n}\n\nconst bot = new MCB({ data, entities })\nconsole.log(bot.process('I want to travel').answer)\n// =\u003e Where do you want to go?\nconsole.log(bot.process('London').answer)\n// =\u003e From where you are traveling?\nconsole.log(bot.process('Paris').answer)\n// =\u003e When do you want to travel?\nconsole.log(bot.process('2022-12-15').answer)\n// =\u003e You want to travel from London to Barcelona the 12/15/2022\n\nconsole.log(bot.process('I want to travel from London to Barcelona the 12/15/2022').answer)\n// =\u003e You want to travel from London to Barcelona the 12/15/2022'\nconsole.log(bot.process('I want to travel to Barcelona from London the 12/15/2022').answer)\n// =\u003e You want to travel from London to Barcelona the 12/15/2022\n```\n\n### Alternatives / inspirations\n- [NLP.JS](https://github.com/axa-group/nlp.js)\n- [Rasa](https://github.com/RasaHQ/rasa)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorgbn%2Fmcb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmorgbn%2Fmcb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorgbn%2Fmcb/lists"}