Search code examples
pythoniostensorflowmachine-learningcoreml

How to train an intelligent chatbot using a database to then add to an iOS app


I want to create an intelligent chatbot-type app for iOS that uses the Cornell movie database and some custom training data I create to train a machine learning model that can talk to the user, preferably keeping track of the conversation and performing a few simple tasks.

I'll go more in depth.

Recently I came across a way to convert TensorFlow models to CoreML models so I tried working with TensorFlow and realized that the conversion method is limited and working with TensorFlow would require me to learn a lot more than I already knew and I simply do not have the time to do that. I am an iOS developer and am therefore familiar with Swift and Objective-C, so I was wondering if there was a way to do the same thing using them.

I would like to be able to train a model with the Cornell movie database I tried using when training TensorFlow, plus whatever contributions I make to it. What I mean by that is I might want my chatbot to do some specific tasks or reply to certain abnormal questions in a specific way. I think I could do this by adding my own "conversations" to the Cornell database that contain my specific needs. If there is some other way I could inject my own data into this, please let me know.

I also want the chatbot to be able to do specific tasks. Therefore I believe I need to have a more complicated model that can recognize when the chatbot is told to do something such as turn on a light here or send a text to someone (very small things that would just need a trigger and some parameters).

It would also be great to have the model remember certain aspects of the conversation. For instance, if the chatbot asks for my name, and I reply, it should remember what my name is later if I ask it what my name is. This would also apply to more complicated things such as a scenario where I ask it what the weather is in Toronto tomorrow, it replies, and then I ask "What about next Tuesday?", and it replies with the weather in Toronto for next Tuesday.

Overall, I would like to use CoreML (and possibly its seemingly very good Natural Language processing capabilities) to create a complex model for a chatbot for iOS applications.

I don't know if this is at all possible but I would really like to try to get the most advanced and conversational chatbot for iOS as possible.


Solution

  • If you’re fine with making calls to an API (which would make it useless without WiFi) and paying for it, Google’s Dialogue Flow might be a good tool for you, as it already has great NLP. You’d still have to do a lot of the information storing by yourself, and write your own functionality for other parts (like actually sending requests to a weather API) but it’s very good for understanding the intent behind someone’s speech.

    If you don’t want to pay or need it to work without WiFi, There is a 40+ hour long course called Natural Language Processing A-Z on Udemy which is very useful for learning NLP with tensorflow. Takes more work but google doesn’t take a cut and you might be able to work without WiFi.