The goal of this project is to be able to solve any anagram of famous person.
We attend a pub quiz once a week and one of the questions is to solve anagram.
That got us wonder what would take to create a web that does just that, and to be able to solve anagram of any famous person.
We decided to tackle that challenge and to create this project as a fun side-project.
- As admin, request import of famous people from wikidata, by just providing occupation id
- As admin, import person manually
- As anonymous user, enter anagram in input field and immediatelly get solution
Project is structured as ASP.NET monolith.
In development, backend automatically starts react app and configures the proxy so that react app consumes mvc controllers.
In production build, react app is built and bundled as APS.NET static asset, being served from it's index page.
For each celebrity, we store full name and anagram key.
Anagram key is calculated as follows:
- Celebrity full name is normalized and case folded, as described in Default Caseless Matching in 3rd chapter of Unicode standard
- Whitespace and punctuation is removed from normalized celebrity full name, as those are neutral characters in anagram
- Result of that is then parsed into Unicode grapheme clusters and then ordered by ordinal value, resulting in what we call anagram key
Such anagram key is stored in anagram key column of celebrity table, and we use hash index type since we are interested only in exact matches.
When user queries for anagram solution, we calculate anagram key from that input and then query the database for matching celebrities.
Requirements
Ensure you have the following dependencies installed on your system:
- dotnet SDK:
version 7.0 or higher
- Node.js
version 14.0.0 or higher
- Postgres
version 14.4 or higher
- Clone the Anagram Solver repository:
git clone [email protected]:tvorova-tvornica/anagram-solver.git
- Change to the project directory:
cd anagram-solver
- Run the Postgres instance locally
docker run --name anagram_solver -p 5432:5432 -e POSTGRES_PASSWORD=postgres -d postgres
- Apply database migrations
dotnet ef database update
- Run the app in watch mode:
dotnet watch