Python Forum
how to recreate akinator in python?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to recreate akinator in python?
#1
akinator is a mind reading app that guesses your character after asking 10 to 30 questions(90 to 99% accurate)

But how does it work?

besides that,i have a few more question:
1)Do akinator gets  all the character and question and images from a server or database?
2)after three wrong guesses made by the akinator,the akinator will ask to input the character that i am thinking and save it into the database,so how does that work ?
3)when the user input and store the data to the database,where is it actually stored?
4)how do i recreated akinator with python?


https://www.quora.com/How-does-the-web-s...nator-work
this website has taught me a little about how akinator work ,but still dont fully understand.....
this too:
http://openbookproject.net/py4fun/animal/animal.html
Reply
#2
26 English characters. With each question you are asking if the character is in the first 13 characters or in the second group. Take the group with the character in it and split it in two. In this way with less then 5 questions the character is guessed
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#3
what about the expansion of the database?


can you show me a basic example of akinator code?
Reply
#4
Because of Christmas here is some code:

import string

def char_guess():
    chars = string.ascii_lowercase
    first, second = chars[:int(len(chars) / 2)], chars[int(len(chars) / 2 + 1):]

    while True:

        answer = input("Your character is in group 1 or group 2? {}\t{}: ".format(first, second))

        if int(answer) == 1:
            first, second = first[:int(len(first) / 2)], first[int(len(first) / 2 + 1):]

        elif int(answer) == 2:
            first, second = second[:int(len(second) / 2)], second[int(len(second) / 2 + 1):]

        else:
            print('Please, provide a corect answer!')


        if len(first) == 1:
            return first

        elif len(second) == 1:
            return second
    
def main():
    char = char_guess()
    print('Your character is {}'.format(char))

if __name__ == '__main__':
    import sys
    sys.exit(main())
Storing the results in some kind of database you will do it alone. For such a simple task I'll suggest you to use something simple like json serialization. For example. 

>>> import json
>>> js_file = open('test.json', 'w')
>>> json.dump({'1': 'one', '2': 'two'}, js_file)
>>> js_file.close()
>>> js_file = open('test.json', 'r')
>>> obj = json.load(js_file)
>>> obj
{'1': 'one', '2': 'two'}
>>>js_file.close()
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#5
(Dec-26-2016, 08:50 AM)wavic Wrote: 26 English characters. With each question you are asking if the character is in the first 13 characters or in the second group. Take the group with the character in it and split it in two. In this way with less then 5 questions the character is guessed

You misunderstood, akinator guesses characters from movies, tv, games, people from real life, youtube etc.
Reply
#6
Hm!  Undecided
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#7
After doing some research about 20q algorithms and akinator,I found this:
https://m.youtube.com/watch?v=DgLBGvjo2zk

But this guy in the video just talk about it and did not show me the actual code.
Can anyone explain more?
Reply
#8
I did some research. A simple binary tree wouldn't help. It's far more complex. If you want to write such a game first you have to learn what is a neural network and how it works. I think here is the patent of the inventor with a full explanation. And here you can see a try for such a game in Python.
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#9
I learn neural network before ,but it is too complicated for me.
Is there anything I can learn before learning the actual neural network?
As for the two links you provided,I have also read them before,but I don't really understand.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020