Simlish-o-matic
About the project
Convert any text into the Simlish language from the game, The Sims; with the power of ChatGPT!
Project info
Difficulty: Easy
Platforms: Python
Estimated time: 1 hour
License: GNU General Public License, version 3 or later (GPL3+)
Items used in this project
Story
Welcome home.
Livin' Ideas Up
I randomly had a thought enter my head today - 'I wonder if ChatGPT can convert text into Simlish'.
Simlish being the made up language from the excellent video game The Sims. Here's an example:
Turns out it can:
So I sat down, put on the Sims soundtrack and made some code to integrate with the ChatGPT API.
Code Party
This project integrates code from a smaller project I made to easily integrate projects in with ChatGPT, called; ChattingGPT.
Grab the code from my GitHub:
git clone --recurse-submodules https://github.com/LordofBone/Convert2Simlish
Install the requirements:
pip install -r requirements.txt
Head to OpenAI and sign up, you should get some free credits for a limited time to use the API, then create an API key.
Copy or rename 'ChattingGPT/config/api_config_template.py' to 'config/api_config.py' and add the API key in.
And now it should be ready to go. Just run the main file:
python main.py
Essentially, the code integrates with the ChatGPT API, sets the context of ChatGPT to act as a translator Sim, then takes in text input and asks ChatGPT to convert it to Simlish.
Let's break down the code line by line:
import sys
import os
These lines import two Python modules: sys
and os
. sys
provides access to some variables used or maintained by the Python interpreter, such as sys.path
, which is a list of directories where Python looks for modules to import. os
provides a way of using operating system dependent functionality like reading or writing to the file system.
chatting_gpt_dir = os.path.join("ChattingGPT")
Here, we create a variable called chatting_gpt_dir
that contains the path to the "ChattingGPT" directory. os.path.join
is a method that takes multiple arguments and joins them together to form a file path, regardless of the operating system being used.
sys.path.append(chatting_gpt_dir)
This line appends the path of the "ChattingGPT" directory to the sys.path
list, so that Python can import modules from that directory.
from ChattingGPT.integrate_chatgpt import IntegrateChatGPT
This line appends the path of the "ChattingGPT" directory to the sys.path
list, so that Python can import modules from that directory.
from ChattingGPT.integrate_chatgpt import IntegrateChatGPT
Here, we import the IntegrateChatGPT
class from the integrate_chatgpt
module within the "ChattingGPT" directory.
integrate_chatgpt_test = IntegrateChatGPT()
This line creates an instance of the IntegrateChatGPT
class and assigns it to the variable integrate_chatgpt_test
.
def main(text_input):
"""
Main function for running translations.
:return:
"""
integrate_chatgpt_test.set_context("you are a sim from the game, 'the sims' - whatever i type in, "
"please translate to simlish")
integrate_chatgpt_test.set_text_input(text_input)
return integrate_chatgpt_test.get_chatgpt_response()
Here, we define a function called main
that takes a single argument, text_input
. This function serves as the main entry point for running translations.
Within the function, we set the context for the integrate_chatgpt_test
object by calling its set_context
method, passing in a string that describes the context for the text input; which requests that it converts whatever is typed in into Simlish.
We then set the text input for the integrate_chatgpt_test
object by calling its set_text_input
method and passing in the text_input
argument. Finally, we return the response from the get_chatgpt_response
method of the integrate_chatgpt_test
object.
if __name__ == "__main__":
while True:
text_input = input("Enter text to translate to Simlish: ")
print(main(text_input))
This code block is executed when the script is run as the main program. It sets up an infinite loop that prompts the user to enter English text to be translated to Simlish. The main
function is called with the user's input as the argument, and the resulting Simlish text is printed to the console.
Hot Demo
Lets give it a basic spin:
Working pretty nicely.
Let's crank it up a notch:
Pretty good. It even kept the quote in English, which makes sense.
So in these cases, where it looks like I'm asking the bot for another example - it gives a good response; but if I want the text of "here's another example" to be translated directly, I need to wrap it in quotes:
We can actually try and confirm a few words by using this little dictionary I found.
This checks out.
Also checks out.
Not quite on those ones... But wooferendum is hilarious.
I've noticed it likes to use "Sul Sul" a lot for translations.
Let's try a goodbye:
Spot on.
And again, not quite. But, pretty good enough it still seems Simlish. Although it did decide to just announce that it was converting to gibberish there.
On Conclusion
So this was a nice easy fun & quick little project to spin up, I know some others have attempted to make Simlish translators before, but thanks to the amazing power of ChatGPT this was insanely easy to make and is quite versatile and fun!
I could even integrate this into a TTS system alongside some STT and have a conversation capable Sim! Although it would be hard to understand anything it says back to you.
There are of course times when there isn't any conversion available so it just reverts to the native language that was input, often with some small bits of random slang inserted. I imagine this and other difficulties are what made development difficult for this Simlish translation project I found.
I'm also sure ChatGPT is just making this stuff up most of the time. It tends to be consistent with some things, such as "hello" converting to "sul sul" which is consistent with the dictionary; but other times with more varied inputs it will change the translation.
This would make sense because as from the link above it states:
Luckily enough Krizia Bajos, one of the Voice Actors for The Sims 4 who is giving the voice for the Lilit Voice Type has shared some interesting facts and previews of what goes on behind Simlish, as well as her official Simlish dictionary.
The real, official Simlish Dictionary exists at this very moment but it’s only available to Voice Actors for The Sims 4.
So there isn't actually that much data to officially translate from other languages to Simlish. Which makes ChatGPT even more impressive as it's almost like asking a person to talk in Simlish - they know the general sounds and style of Simlish so they could probably do a decent job; but they wouldn't really know what the actual structure and lexicon of Simlish is. So it shows that ChatGPT really does have at least some form of 'imagination' based off of all the data it has been trained on, that allows it to make up Simlish on the fly.
The ChatGPT API has really opened the gates for what's possible now... I can't wait to integrate it in with more things. Especially robots.
Feel free to check the code out and let me know what you think!
See you next time
Leave your feedback...