{"id":17954333,"url":"https://github.com/veler/notepad-based-calculator","last_synced_at":"2025-07-14T23:05:05.690Z","repository":{"id":63396236,"uuid":"521045457","full_name":"veler/notepad-based-calculator","owner":"veler","description":"A smart calculator using natural language processing","archived":false,"fork":false,"pushed_at":"2022-10-30T19:10:21.000Z","size":1156,"stargazers_count":29,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-05T00:11:58.899Z","etag":null,"topics":["calculator","csharp","dotnet","mef","natural-language-processing","nlp"],"latest_commit_sha":null,"homepage":"","language":"C#","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/veler.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-08-03T22:05:44.000Z","updated_at":"2025-02-19T17:42:58.000Z","dependencies_parsed_at":"2022-11-18T04:45:44.964Z","dependency_job_id":null,"html_url":"https://github.com/veler/notepad-based-calculator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/veler/notepad-based-calculator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veler%2Fnotepad-based-calculator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veler%2Fnotepad-based-calculator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veler%2Fnotepad-based-calculator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veler%2Fnotepad-based-calculator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/veler","download_url":"https://codeload.github.com/veler/notepad-based-calculator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veler%2Fnotepad-based-calculator/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265365545,"owners_count":23753349,"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":["calculator","csharp","dotnet","mef","natural-language-processing","nlp"],"created_at":"2024-10-29T10:13:17.959Z","updated_at":"2025-07-14T23:05:05.660Z","avatar_url":"https://github.com/veler.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# notepad-based-calculator\n\nThis is a unfinished project, but it is in a state where you can easily reuse it.\n\n# The concept\nMaking an app similar to [numi.app](https://numi.app), [soulver.app](https://soulver.app) and [parsify.app](https://parsify.app), cross-platform using C#.\n\n# Current state\nThe calculator engine is about 100% done. But it remains a few features I wanted to add that I didn't finish.\n\n| Feature                                  | Example                                    | Support |\n| ---------------------------------------- | ------------------------------------------ | ------- |\n| Basic algebra using digits               | 2 + 3                                      | ✅      |\n| Basic algebra using plain words          | two plus three                             | ✅      |\n| Implicit algebra operations              | 20 (50)                                    | ✅      |\n| Nested grouped operation                 | (12)3+(1 +2)(3(2))(1 +2)-3                 | ✅      |\n| Binary operations                        | 0.2 \u003e= a fifth                             | ✅      |\n| Percentage calculation                   | 10 + 25%                                   | ✅      |\n| Comments                                 | 12 + 3 // anything after \"//\" is ignored   | ✅      |\n| Headers                                  | # Title                                    | ✅      |\n| Variables                                | my income tax = 25%                        | ✅      |\n| Conditions                               | if my income tax \u003e 30% then $123 else $456 | ✅      |\n| Unit calculation                         | 2km + 25% // should result 2.5 km\u003cbr\u003e2 USD + 2 CAD // should result something like 3.05 USD\u003cbr\u003e3 MB - 2 KB // should result 2.998 MB\u003cbr\u003eSupports length, mass, currencies, area, angle, volume, speed, temperature, date and time, percentage, computer data          | ✅      |\n| Function grammars (see detail below)    | PERCENTAGE of what is NUMERIC\u003cbr\u003ei.e: 25% of what is 50 // should result 200 | ✅      |\n| Multilanguage                            | deux plus trois | ✅ (partial)      |\n| Unit conversion                          | What is 1 USD in EUR\u003cbr\u003e1km in meters\u003cbr\u003e**Shouldn't be too complicated to implement using _function grammar_** | ❌        |\n\n**Please check the unit tests for a complete list of supported scenarios.**\n\n# Technical details\n\n## Overall architecture\n\n* **NotepadBasedCalculator.Api**\u003cbr\u003e\nThis is the public API.\n* **NotepadBasedCalculator.Core**\u003cbr\u003e\nThis is core engine. It contains the lexer, parser and generic interpreter.\n* **NotepadBasedCalculator.BuiltInPlugins**\u003cbr\u003e\nContains all the basic extensions, which includes the components for parsing and interpreting units, basic algebra and binary operation and built-in functions grammars.\n\n* **NotepadBasedCalculator.StandaloneConsoleTestApp**\nThis is a console app you can use for testing the calculator manually. Check out how this project is made to understand how to use the calculator.\n\n![Screenshot](screenshot.png)\n\n## Extensiblity \u0026 Dependency injection\n\nThis project uses [MEF](https://learn.microsoft.com/en-us/dotnet/framework/mef/) as primary dependency injection \u0026 extensibility framework.\n\n## Function grammars\n\nThe calculation engine supports various kind of input data: percentage, length, numbers, etc.\nWhile this app/library tries to be smart enough to understand input like `25% of what is 50`, it isn't smart enough to understand such an input without the help of a pre-defined grammar.\n\nThe full grammar for English language can be found here: [FunctionDefinition.json](https://github.com/veler/notepad-based-calculator/blob/main/src/app/dev/NotepadBasedCalculator.BuiltInPlugins/Grammars/en-us/FunctionDefinition.json)\n\nEach function is associated to a [MEF](https://learn.microsoft.com/en-us/dotnet/framework/mef/) extension. The C# implementation automatically binds the class with the function name from the grammar. Here is an example:\n1. [Grammar for `25% of what is 50`](https://github.com/veler/notepad-based-calculator/blob/84c8842b1f15572c9f27608f0c09c0e059a17017/src/app/dev/NotepadBasedCalculator.BuiltInPlugins/Grammars/en-us/FunctionDefinition.json#L25-L33)\n2. [Implementation in C#](https://github.com/veler/notepad-based-calculator/blob/84c8842b1f15572c9f27608f0c09c0e059a17017/src/app/dev/NotepadBasedCalculator.BuiltInPlugins/Functions/Percentage/IsPercentOfWhatInterpreter.cs#L3-L51)\n\n## Main third-party dependencies for the calculator engine\n- [Community Toolkit](https://github.com/CommunityToolkit/dotnet)\n- [Microsoft.Recognizers.Text](https://github.com/microsoft/Recognizers-Text)\n- [UnitsNet](https://github.com/angularsen/UnitsNet)\n- [Newtonsoft.Json](https://www.newtonsoft.com/json)\n\n# How to build and run?\n\n## Set up development environment\n- Visual Studio 2022 with Desktop Development workload (Windows)\n- Rider (Windows or MacOS)\n- VS Code with C# extension (MacOS)\n- _**(Optional)**_ [Avalonia UI](https://docs.avaloniaui.net/docs/getting-started)\n\n## Set up repository\n1. Clone the repository\n2. Run `init.ps1` (or `.sh`) to download all the required dependencies.\n\n## Build \u0026 Debug\n1. Open `src/NotepadBasedCalculator.App.sln` in Visual Studio or Rider.\n2. Set `NotepadBasedCalculator.StandaloneConsoleTestApp` as startup project.\n3. F5 😉","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fveler%2Fnotepad-based-calculator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fveler%2Fnotepad-based-calculator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fveler%2Fnotepad-based-calculator/lists"}