{"id":16609404,"url":"https://github.com/artbit/bash-intents","last_synced_at":"2026-05-16T00:38:38.548Z","repository":{"id":208404122,"uuid":"721496894","full_name":"ArtBIT/bash-intents","owner":"ArtBIT","description":"Ultra simple natural language processing in bash","archived":false,"fork":false,"pushed_at":"2023-11-21T18:24:31.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-08T21:39:08.125Z","etag":null,"topics":["bash","bash-scripting","natural-language-processing","nlp","nlp-parsing"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ArtBIT.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-11-21T07:23:54.000Z","updated_at":"2023-11-21T10:19:49.000Z","dependencies_parsed_at":"2023-11-21T10:36:59.881Z","dependency_job_id":"83925be4-1371-4411-baf5-14317ba0ad64","html_url":"https://github.com/ArtBIT/bash-intents","commit_stats":{"total_commits":15,"total_committers":1,"mean_commits":15.0,"dds":0.0,"last_synced_commit":"f4af3bc849b4b5a44ca7f54956ac89fbf825529b"},"previous_names":["artbit/bash-intents"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArtBIT%2Fbash-intents","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArtBIT%2Fbash-intents/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArtBIT%2Fbash-intents/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArtBIT%2Fbash-intents/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ArtBIT","download_url":"https://codeload.github.com/ArtBIT/bash-intents/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242896314,"owners_count":20203349,"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":["bash","bash-scripting","natural-language-processing","nlp","nlp-parsing"],"created_at":"2024-10-12T01:28:59.647Z","updated_at":"2025-10-26T22:35:28.148Z","avatar_url":"https://github.com/ArtBIT.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bash-Intents\n[![GitHub license](https://img.shields.io/github/license/ArtBIT/bash-intents.svg)](https://github.com/ArtBIT/bash-intents) [![GitHub stars](https://img.shields.io/github/stars/ArtBIT/bash-intents.svg)](https://github.com/ArtBIT/bash-intents)  [![awesomeness](https://img.shields.io/badge/awesomeness-maximum-red.svg)](https://github.com/ArtBIT/bash-intents)\n\nUltra simple natural language processing in bash\n\n# Purpose\n\nThe general purpose of Bash Intents is to simplify natural language interaction in the command line. It uses regular expressions to match input text to an intent file. The intent files are located in the `./intents` subdirectory, and they simply define the `intent_regex` array of regex rules and an `intent_handler` function to run if the intent is matched.\n\nI have a smart microphone [ATOM Echo Smart Speaker](https://shop.m5stack.com/products/atom-echo-smart-speaker-dev-kit) and I needed a way to map spoken word into script actions, so I've built this.\n\nIt's a glorified regex mapper. For each intent (which is a file in the `./intents` subdirectory(, you define a list of regex rules, and a handler. A minimal intent file would look like this:\n\n```\n# ./intents/hello-world\n\nintent_regex=(\n    \"My name is \u003cname\u003e\" \n)\n\nintent_handler() {\n    local sentence=\"$1\"\n    eval \"$2\" # expands the named capture groups to bash variables\n              # \u003cname\u003e from the intent_regex will be available as $name here\n\n    # we can save the value in the `./state.vars` file\n    set_state \"name\" \"$name\" \n\n    case \"$name\" in\n        world)\n            echo \"Hello World!\"\n            ;;\n        *)\n            echo \"Hello, $name\"\n    esac\n}\n```\n\nThen, you would just say:\n```\n./bash-intents.sh My name is world.\n# and you would get the following response\nHello World!\n```\n\nCheck the [./intents](./intents) subdirectory, to see more examples.\n\n# Installation\n```\n$\u003e git clone https://github.com/ArtBIT/bash-intents.git\n\n# Alias it to, say, computer, alexa, jarvis, etc.\n$\u003e echo alias computer=\"$PWD/bash-intents/bash-intents.sh\" \u003e\u003e \"$HOME/.bashrc\"\n```\n\n# Usage\n```\n$\u003e computer start the demo \n# It stores a state value in `state.vars`\n# Check the ./intents/activate intent_handler to see what the demo does\n\n$\u003e computer what is the status of the demo?\n# It reads a state value from `state.vars`\nThe demo is running.\n\n$\u003e computer stop the demo\n# It updates a state value in `state.vars`\n\n$\u003e computer what is the status of the demo?\nThe demo is not running.\n# It reads a state value from `state.vars`\n\n# starting/stopping/statuses for services in /etc/init.d/* are built in\n$\u003e computer what is the status of bluetooth?\nThe bluetooth is running\n\n$\u003e computer what is the status of cron?\nThe cron is running\n```\n\nYou can add more intents by creating a new intent file in the `intents` subdirectory.\n\nYou can specify your own `intents` directory using the `$BASH_INTENTS_DIR` environment variable. \n```\nexport BASH_INTENTS_DIR=$HOME/intents\n```\n\n[![asciicast](https://asciinema.org/a/LbNOgxhO1fuNRgI1eOM3nyZrd.svg)](https://asciinema.org/a/LbNOgxhO1fuNRgI1eOM3nyZrd)\n\n# License\n\n[MIT](LICENSE.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartbit%2Fbash-intents","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fartbit%2Fbash-intents","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartbit%2Fbash-intents/lists"}