{"id":20044119,"url":"https://github.com/rockfordwei/anagram","last_synced_at":"2026-04-12T00:02:18.511Z","repository":{"id":121653242,"uuid":"123961703","full_name":"RockfordWei/anagram","owner":"RockfordWei","description":"Anagram Solution Servers in Different Languages/Frameworks","archived":false,"fork":false,"pushed_at":"2018-03-31T13:43:44.000Z","size":43,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-02T07:34:55.297Z","etag":null,"topics":["anagram","hdfs","java","javascript","php","python","server","spark","swift"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RockfordWei.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-05T18:35:09.000Z","updated_at":"2020-06-02T20:25:40.000Z","dependencies_parsed_at":"2024-08-18T15:33:00.521Z","dependency_job_id":null,"html_url":"https://github.com/RockfordWei/anagram","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/RockfordWei/anagram","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RockfordWei%2Fanagram","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RockfordWei%2Fanagram/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RockfordWei%2Fanagram/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RockfordWei%2Fanagram/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RockfordWei","download_url":"https://codeload.github.com/RockfordWei/anagram/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RockfordWei%2Fanagram/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261786875,"owners_count":23209563,"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":["anagram","hdfs","java","javascript","php","python","server","spark","swift"],"created_at":"2024-11-13T10:59:54.767Z","updated_at":"2026-04-12T00:02:18.458Z","avatar_url":"https://github.com/RockfordWei.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Anagram Solution Server in Different Languages/Frameworks\n\n- [Swift (Powered by Perfect)](Swift/)\n- [Python](Python/)\n- [PHP](PHP/)\n- [Java](Java/)\n- [Java+Spark](Java+Spark/)\n- [JavaScript (Powered by NodeJS)](JavaScript/)\n- [JavaScript (Powered by NodeJS with C++ AddON)](JavaScript+C++/)\n\n# Algorithm\n\nAll standalone servers are using the same workflow: \n\n1. Download a word list, i.e., words separated by line.\n2. Turn the list into groups by size. For example, `['eat', 'god']` are in the same size of 3 but `['wood', 'fine']` are in group of size 4.\n3. In each group, split the group into hash tables by \"word sum\". The sum means to add all letter ascii code in a word. For example, `sum(\"bad\")` will be `(b = 98) + (a = 97) + (d = 100) =\u003e 295`. \n4. Once these two simple hash indexes were built, the solution would be very easy, which is just pick up the same-size-same-sum word list, and perform a for-loop to compare the frequency tables to figure out the matches.\n5. Start an http server to provide a solution JSON api. For example, `$ curl http://localhost:8181/?anagram=eat` should return `[\"tea\",\"ate\",\"eta\"]` if nothing wrong.\n\n## Why?\n\nSuch an algorithm is applying a balance between memory and cpu. \n\nFirstly, two integer indices are light enough and can scope down the search quickly enough.\n\nSecondly, the final frequency table match is only happening in a very narrow scope.\n\nLast but not the least, frequency tables are calculated intermediately in the solution so it would never accumulate or waste too much cpu or memory.\n\n# Acknowledgement\n\nAll above servers are using a word list from [https://github.com/first20hours/google-10000-english](https://github.com/first20hours/google-10000-english)\n\n# More Info\n\nPlease visit [Perfect](https://github.com/PerfectlySoft) for more information, if using Swift.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frockfordwei%2Fanagram","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frockfordwei%2Fanagram","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frockfordwei%2Fanagram/lists"}