{"id":20511465,"url":"https://github.com/friedrith/natural-script","last_synced_at":"2026-05-08T08:35:39.293Z","repository":{"id":16265048,"uuid":"79368897","full_name":"friedrith/natural-script","owner":"friedrith","description":"Script language to parse english expressions.","archived":false,"fork":false,"pushed_at":"2023-01-09T22:35:50.000Z","size":2086,"stargazers_count":2,"open_issues_count":17,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-14T15:32:39.569Z","etag":null,"topics":["bot","extract-information","occurences","parse","scripting-language"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/friedrith.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-18T18:11:21.000Z","updated_at":"2020-02-10T02:09:24.000Z","dependencies_parsed_at":"2023-01-14T07:00:12.394Z","dependency_job_id":null,"html_url":"https://github.com/friedrith/natural-script","commit_stats":null,"previous_names":["thibaultfriedrich/natural-script"],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/friedrith/natural-script","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/friedrith%2Fnatural-script","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/friedrith%2Fnatural-script/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/friedrith%2Fnatural-script/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/friedrith%2Fnatural-script/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/friedrith","download_url":"https://codeload.github.com/friedrith/natural-script/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/friedrith%2Fnatural-script/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32773332,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"ssl_error","status_checked_at":"2026-05-08T08:22:45.650Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","extract-information","occurences","parse","scripting-language"],"created_at":"2024-11-15T20:36:04.263Z","updated_at":"2026-05-08T08:35:39.266Z","avatar_url":"https://github.com/friedrith.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# natural-script [![Build Status](https://travis-ci.org/friedrith/natural-script.svg?branch=master)](https://travis-ci.org/friedrith/natural-script)\n\n**Natural-script** is a script language to easily parse english expressions.\nIt also includes a node.js implementation of a parser.\n\nWhen you write a bot (slack bot, messenger bot, etc) you have to parse user inputs, classify it and extract information you need. It is easy to classify simple user sentences like _hello_, _How are you?_, _What time is it in London ?_. But it is quite harder when you want to extract complex information. Try for example to parse the date from the expression _my appointment is planned for tomorrow at 2pm at home_.\n\n\u003e You could use Natural Language Processing but sometimes it is a bit overkill. Besides sometimes you expect very specific commands and NLP may be as strict as expected.\n\nWith **natural-script**, describe the request you expect with a simplified expression based on english words. These are some examples of **natural-script** language :\n\n```javascript\nHello\n~hello\nhow are you\nmy email is {email}\ngo to {url:var1}\n```\n\n## Getting started\n\nFor now, this project is only available for node.js because it uses [natural](https://github.com/NaturalNode/natural).\n\n```bash\n# with npm\n$ npm install natural-script\n\n# with yarn\n$ yarn add natural-script\n```\n\n```javascript\nimport { parse } from 'natural-script'\n(async () =\u003e {\n  // parse returns a promise\n  // await parse(\u003cuser input\u003e, \u003cpattern to match\u003e)\n\n  // by default parse accepts only strict equal strings\n  (await parse('Hello', 'hello')) === false\n\n  // ~ accepts similar words\n  (await parse('Hello', '~hello')) === true\n  (await parse('Hello', '~helo')) === true\n  (await parse('Bonjour', '~hello')) === false\n\n  // detects words and returns them\n  (await parse('hello thibault', 'hello {word}')) === true\n  (await parse('hello thibault', 'hello {word:name}')) === { name: 'foo' }\n\n  // detects emails and returns them\n  (await parse('my email is foo@bar.com', 'my email is {email}')) === true\n  (await parse('my email is foo@bar.com', 'my email is {email:foo}')) === { foo: 'foo@bar.com' }\n\n  // detects urls and returns them\n  (await parse('go to http://foo.com', 'go to {url}')) === true\n  (await parse('go to http://foo.com', 'go to {url:bar}')) === { bar: 'http://foo.com' }\n})()\n```\n\n## Contribution\n\nThis project is only at the beginning so do not hesitate to contribute or propose improvements.\nPlease follow [guidelines](CONTRIBUTING.md).\n\n## License\n\nThis project is distributed on MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffriedrith%2Fnatural-script","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffriedrith%2Fnatural-script","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffriedrith%2Fnatural-script/lists"}