Mythologue - Natural Language Processing


So Mythologue started with the core idea that the myth's would adapt to your way of storytelling, and come to include any errors you make along the way.

To achieve this, I wanted to utilise some of the same natural language processing as chat-gpt and similar AI, but since i only needed to determine semantic similarity and not generate any content, I didn't want to overload my project with API calls or massive databases.

After a bit of experimentation, I landed on using NLTK and WordNet. While wordnet does have a database, itscomparatively small, keeping the project lightweight.

The game will split Myths up into unique sentences. When it presents the player with a question, that question will be linked to a specific sentence in the myth. It then calls the python script to compare the players answer to the answer to the question.

The python script processes the sentence into tokens, and then into "Synsets" using WordNets method.

text processing

 These synsets are then compared to find the best-match between the sentences, using the WordNet wup_similarities method. 

similarity comparisons

Finally, the average of the best-matches is taken to develop a rough indication of whether 2 sentences have similar meanings. This is then passed back to Godot to determine whether the answer is accepted or not.

Its not a perfect system to picking up sentence meaning, and overly relies on words being similar in usage - but that should also allow for an element of flexibility, letting the player change the structure of sentences as they progress.

This whole process can take some time, 2-3 seconds depending on the length of the sentences. So I will need to use some threading in Godot, and develop a "thinking" animation for the application so that the user experience doesn't suffer.

Get Mythologue

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.