Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/glynnbird/anagrammer
Anagram solver
https://github.com/glynnbird/anagrammer
Last synced: 5 days ago
JSON representation
Anagram solver
- Host: GitHub
- URL: https://github.com/glynnbird/anagrammer
- Owner: glynnbird
- Created: 2015-01-15T15:45:01.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-01-15T17:07:21.000Z (almost 10 years ago)
- Last Synced: 2024-10-12T22:13:10.393Z (about 1 month ago)
- Language: JavaScript
- Size: 883 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Anagrammer
A simple anagram solving application. Very simple documents containing only the word to be indexed, are stored in Cloudant e.g.
```
{
"_id": "astronomer"
}
```A MapReduce index is created to index the letters of the words in alphabetical order:
```
function(doc) {
var generateDigest = function(str) {
str = str.toLowerCase().replace(/[\-',\./%\? ]/g,"");
return str.split("").sort().join("");
};
emit( generateDigest(doc._id), null);
}```
which produces keys like this:
```
"aemnoorrst" ---> null
```We can then query the view, with a pre-processed string to find the solution to an anagram:
```
curl 'https://reader.cloudant.com/anagrammer/_design/fetch/_view/byDigest?key="aemnoorrst"'```
This repository contains
* the text files used to make the dictionary
* the code required to make a BlueMix application which queries the database