Blog

Anagrams Factory

About the application

I created Anagrams Factory to learn and try some interesting technologies like Angular, TypeScript, Python, Scss and Bootstrap. The application calculates anagrams for a given word and, if required, check the anagrams to find real words using the English Dictionary.

The full code is reachable on my GitHub account

The frontend of the application has been built with Angular and the backend with Python. The backend consists of rest services that provide two endpoint: one to get anagrams of a provided word and one to check the anagrams to find real words.


How it work

In the first step, the user can insert the word to use to generate the anagrams, then click the button with the label “Anagrams”. Once the button is pressed, the frontend of application calls a rest service of the backend that returns the anagrams.

Anagrams Factory - Step 1
Anagrams Factory – Step 1

The anagrams found are shown in the second step. If the results are more then 10, they will be paginated. To go to next step the user can click on the button with the label “dictionary search”.

Anagrams Factory - Step 2
Anagrams Factory – Step 2

In the step 3 the application checks the anagrams to find real words using the English Dictionary. The progress of the operation are shown by two progress bar.

Anagrams Factory - Step 3
Anagrams Factory – Step 3

To check the anagrams the application performs multiple requests to backend and each request ask to check a certain number of anagrams. The requests are managed asynchronously.

Anagrams Factory - Step 3 - Requests
Anagrams Factory – Step 3 – Requests

In the step 4 are shown all the word found in the English Dictionary with theirs definitions.

Anagrams Factory - Step 4
Anagrams Factory – Step 4

Python rest service

The rest service has been built in Python through Flask, a WSGI (Web Server Gateway Interface) web application framework. In the following code is shown how the backend manage the two routes callable from the frontend.

# ROUTE: anagrams
@app.route('/anagrams', methods=['GET'])
def returnAnagrams():
    return Response(getAnagrams(request.args['text']), mimetype='text/plain')


# ROUTE: dictionary
@app.route('/dictionary', methods=['POST'])
def returnTrueWord():
    if request.json and 'list' in request.json:
        results = getTrueWord(request.json['list'])
        if (len(results) > 0):
            return json.dumps(results), 200
        else:
            return '', 204

Conclusion

The project is released under GNU General Public License v3.0. It include scripts for development and to build a production version.

For questions, comments or suggestions, use my contact page.

Enjoy!

  Riccardo Giovarelli    All rights reserved 

  •  
  • 2
  •  
  •