{"id":21032462,"url":"https://github.com/vshawn/variablekeywordmatcher","last_synced_at":"2025-07-06T13:35:15.440Z","repository":{"id":98715193,"uuid":"346662514","full_name":"VShawn/VariableKeywordMatcher","owner":"VShawn","description":"VariableKeywordMatcher is library offering several string-keyword matchers, they allow you match keyword by Initials\\Chinese PinYin\\Japanese Romaji... You can get the keyword hit position that allow you to high light the matched words.","archived":false,"fork":false,"pushed_at":"2023-11-02T11:36:38.000Z","size":2258,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-04T19:48:18.266Z","etag":null,"topics":[],"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/VShawn.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}},"created_at":"2021-03-11T10:24:34.000Z","updated_at":"2024-06-25T07:01:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"92658f7d-a0d1-4131-9193-ec0ec9912dd2","html_url":"https://github.com/VShawn/VariableKeywordMatcher","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/VShawn/VariableKeywordMatcher","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VShawn%2FVariableKeywordMatcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VShawn%2FVariableKeywordMatcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VShawn%2FVariableKeywordMatcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VShawn%2FVariableKeywordMatcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VShawn","download_url":"https://codeload.github.com/VShawn/VariableKeywordMatcher/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VShawn%2FVariableKeywordMatcher/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260639179,"owners_count":23040455,"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":[],"created_at":"2024-11-19T12:43:19.308Z","updated_at":"2025-06-18T21:39:56.514Z","avatar_url":"https://github.com/VShawn.png","language":"C#","readme":"![](./doc/icons/icon-64.png)\n\n# [Variable-Keyword-Matcher](https://github.com/VShawn/VariableKeywordMatcher)\n\nVariableKeywordMatcher is a C# lib for:\n- English initials matching\n- English discrete matching\n- Chinese PinYin matching\n- Japanese Romajin matching\n- highlight multiple keywords in search\n- pluggable for more spell matching for future. (e.g. [Tongyong Pinyin](https://en.wikipedia.org/wiki/Tongyong_Pinyin), [Korean Hangul](https://en.wikipedia.org/wiki/Hangul) ... )\n\n![](./doc/GifDemo/demo.gif)\n\n\n## Usage\n\n### Install\n\nInstall from nuget:\n\n[VariableKeywordMatcher](https://www.nuget.org/packages/VariableKeywordMatcher/)\n\n[(optional)MatcherProvider: ChineseZhCnPinYin](https://www.nuget.org/packages/VariableKeywordMatcher.Provider.ChineseZhCnPinYin/)\n\n[(optional)MatcherProvider: ChineseZhCnPinYinInitials](https://www.nuget.org/packages/VariableKeywordMatcher.Provider.ChineseZhCnPinYinInitials/)\n\n[(optional)MatcherProvider: JapaneseRomaji](https://www.nuget.org/packages/VariableKeywordMatcher.Provider.JapaneseRomaji/)\n\n\n### QuickStart\n\n1. Get the names of available matchers\n\n```C#\nvar availableProviderNames = VariableKeywordMatcher.Builder.GetAvailableProviderNames().ToList();\n```\n\n2. Make a list of which providers you want to use.\n\n```C#\nvar enabledProviderNames = new ist\u003cstring\u003e();\nenabledProviderNames.AddavailableProviderNames[0]);\nenabledProviderNames.AddavailableProviderNames[1]);\n```\n\n3. Create the matcher(case sensitive = false)\n\n```C#\nvar matcher = VariableKeywordMatcher.Builder.Build(enabledProviderNames);\n```\n\n4. Build cache for original strings\n\n```C#\nvar matchCache = matcher.CreateStringCache(\"Hello World\");\n```\n\n5. Match with the keywords\n\n```C#\nvar result = matcher.Match(matchCache, new List\u003cstring\u003e() { \"he\", \"wo\" });\n```\n\n6. print result\n\n```C#\nif (result.IsMatchAllKeywords == true)\n{\n    // print where should be high-light\n    for (int i = 0; i \u003c result.HitFlags.Count; i++)\n    {\n        if (result.HitFlags[i] == true)\n        {\n            // highlight\n            Console.Write($\"[{result.OriginalString[i]}]\");\n        }\n        else\n        {\n            // normal\n            Console.Write($\"{result.OriginalString[i]}\");\n        }\n        Console.WriteLine();\n    }\n}\nelse\n{\n    Console.WriteLine(\"Not matched\");\n    for (int i = 0; i \u003c result.KeywordsMatchedFlags.Count; i++)\n    {\n        if (result.KeywordsMatchedFlags[i] == false)\n        {\n            Console.WriteLine($\"{result.Keywords[i]} was not matched\");\n        }\n    }\n}\n```\n\n### Demo project [PRemoteM](https://github.com/VShawn/PRemoteM)\n[![](https://raw.githubusercontent.com/VShawn/PRemoteM/Doc/DocPic/quickstart.gif)](https://github.com/VShawn/PRemoteM)\n\n\n## Included Components\n\n- https://github.com/rvhuang/kmp-algorithm (MIT)\n- https://github.com/toolgood/ToolGood.Words.Pinyin (MIT)\n- https://github.com/Cutano/Kawazu (MIT)\n- https://github.com/komutan/NMeCab (GPL 2.0 / LGPL 2.0)","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvshawn%2Fvariablekeywordmatcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvshawn%2Fvariablekeywordmatcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvshawn%2Fvariablekeywordmatcher/lists"}