Food Recommendation System using Chatbot

Page 1

International Research Journal of Engineering and Technology (IRJET) e ISSN: 2395 0056

Volume: 09 Issue: 06 | Jun 2022 www.irjet.net p ISSN: 2395 0072

Food Recommendation System using Chatbot

1VIII Semester, Dept. of ISE, BNMIT

2 VIII Semester, Dept. of ISE, BNMIT

3Asst. Professor, Dept. of ISE, BNMIT, Karnataka, India ***

Abstract Diet is a very important aspect in today’s world with the pandemic going on, consumption of right kind of food in right amount can be vaguely defined as diet. Lately, Diet is something which is not given much importance. In 2020, according to the International Diabetes Federation (IDF), 463 million people have diabetes in the world. People suffering from diabetes need to have control about their consumption of food. To make an individual understand the importance of diet and diabetes, we are trying to build a chatbot which serves the purpose. Therefore, a user friendly conversational agent like chatbot can be implemented for better user interaction which can give solutions to people’s common questions like “What type of food should I eat?”, “Can I eat junk food?”, “Which diet is better for a person who is suffering from diabetes?” and so on. The proposed system also tries to recommend medicine dosage according to the doctor’s prescription. It also calculates the BMI (Body Mass Index) and tries to provide regular diet for individuals too.

1. INTRODUCTION

Goodamountofnutrientsinourbodyisanimportantpartof leadingahealthylifestyle.Goodfoodcombinedwithphysical activitycanmakeapersonphysicallyfitandmentallytoo.To maintainbothphysicalhealthandmentalhealth,adietplays a very important role. The proposed system is uses Rasa, which is a python based open source chatbot framework. According to a poll undertaken by the World Health Organization(WHO),roughly30%oftheworld'spopulation isaffectedbydiseasessuchasdiabetes,highbloodpressure, andsoon.Malnutritionisalsoresponsibleforaround60% ofallchilddeathseachyear.AccordingtoaWHOstudy,poor andunbalanceddietaryintakeisresponsibleforroughly9% ofheartattackfatalitiesand14%ofgastrointestinalcancer deathsworldwide.

Furthermore, around 0.25 billion children are Vitamin A deficient,0.2billionpeopleareirondeficient(anaemia),and 0.7 billion people are iodine deficient. Keeping all these statistics in mind, the proposed system tries to provide a healthy and likeable diet to the user in order to improve their food intake and maintain their physical and mental health.Afterthepandemichittheworld,peoplearescared tovisithospitalsforsmalldiseases.Sincehealthcareplaysa majorroleinone’slife,achatbotcanbeofgreatuseattheir ease.

Thefollowingfoodsarepartofahealthydiet: 

Fruit,vegetables,legumes,nuts,andwholegrains areallgoodsourcesoffibre. 

Aminimumof400grammesoffruitsandvegetables each day, omitting potatoes, sweet potatoes, cassava,andotherstarchyroots.

Less than 10% of total energy intake from free sugars, which is comparable to 50g for a healthy bodyweightconsumingroughly2000caloriesper day, but ideally less than 5% for added health benefits. Sugars added to foods or drinks by the manufacturer,cook,orcustomer,aswellassugars naturally found in honey, syrups, fruit juices, and fruit juice concentrates, are all considered free sugars. 

Consume less than 5 grammes of salt every day. Iodizedsaltshouldbeused

2. LITERATURE REVIEW

1.Thispaperdisclosesavirtualconversationalmethodand systemtorelievethepsychologicalstressofadolescents.This Chatbotwillallowausertosimplyaskquestionsinthesame waythattheywouldaddressahuman.Thetechnologyatthe coreoftheproposedchatbotisNaturalLanguageProcessing (“NLP”). The authors for this paper are Dr. Dipti Patil , SurekhaIyer,PoojaMehta,DeeshaGavand.Theideabehind this chatbot is to develop a BMI calculator by taking in personaldetailsoftheuser.Basedontheuser’sBMI,thebot calculates required diet system. The methodology used is RASA.[1]

2.Thetitleofthesecondpaper[2]isDiet Right:ASmart FoodRecommendationSystemandauthorsofthepaperare Faisal Rehman, Osman Khalid , Nuhman Ul Haq , Atta Ur RehmanKhan,KashifBilal,AndSajjadA.Madani.Diet Right is a food recommendation system which is cloud based, whichhelpsincontrollingvariousdiseases.

Itiscollectionofmanyrecommendationsystems,like a.FoodrecommendationSystem b.DietPlanRecommendationSystem,

©
Journal | Page2099
2022, IRJET | Impact Factor value: 7.529 | ISO 9001:2008 Certified

International Research Journal of Engineering and Technology (IRJET) e ISSN: 2395 0056

Volume: 09 Issue: 06 | Jun 2022 www.irjet.net p ISSN: 2395 0072

c.HealthRecommendationSystem.

The system mainly focuses on diabetic patients. Uses ACO (AntColonyOptimization)algorithmisusedtogeneratefood for the users. It is a constructive and population based approachwhichreliesonsocialbehaviourofants.Itisused fortrainingthemodel withthevaluesalongwithdifferent parameters.

3.Byembracingthebottomlevelimplementationofnatural language processing, this study presents a mechanism for constructing knowledgable chat applications that do not allowtheusertotransmitunsuitableorimpropermessages to the participants (NLP). The author of the paper are N.Naveenkumar,M.HemanthReddy,S.SaiNikitha,T.SaiRam Reddy[3]

4.Inthispaper[4],theusershavetoregisterthemselvesto initiateconversationwithchatbot.Ifthechatbotisn’taware oftheanswers,thenanexpertsystemisusedtoanswerthe queries. Data is stored in database in the form of pattern template. The user gives the input in a textual format and thenthechatbotwillperformthepre processingstepswhere tokenization is incorporated and along with feature extraction, all words are tokenized and stop words are deleted. n gram, TF IDF, and cosine likeness are used to extractfeatures.Stopwordsextractionaidsintheextraction ofsignificantwordsfromsentences.

5.ICD 10isanessentialprocessintransformingdescriptions ofmedicaldiagnosisandproceduresintouniversalmedical codenumbers.

Here,Dialogflowwaschosentodevelopachatbotwherethe input will be processedintointent and context. The result will be selected by chatbot based on how close it is with user’svolitionandreplycanbeintext,audio,imagesetc.[5]

6.Poornutritioncanreduceimmunityandaremoreproneto diseases,reducesproductivity,increasesphysicalandmental development. This paper aims in providing healthy nutritionalrecommendation[6]

3. PROPOSED METHODOLOGY

The proposed system is a chatbot which tries to act as a mediator betweenthesystemandtheuser. Oncetheuser sets up his credentials, the user logs into the system and startstohaveaconversationwiththesystem.Thesystem takes in basic information like name, height, weight and other personal details. Our chatbot mainly focuses on diabetes.Thesystemprovidesadietforapersonsuffering from either type 1 or type 2 diabetes. Based on the data collectedabouttheuser’shealthrelateddetails,thechatbot goesbacktothedatabasetofindtheresponsefortheuser’s intent.Oncethereposeiscollectedbythechatbot,itisthen verifiedandtheresponseisgiventotheuser.Diabetesisone ofthemostcommonchronicdiseaseinIndia. Peopledonot

paymuchattentiontoitandconsumeanykindoffood.Ina long run, food which contain a lot of sugar content is not goodforthebodyandwillleadtodiabetes.Ithasbecomeso common in the current day world that, children who are about4or5issufferingfromdiabetesandarenotallowedto eatfoodcontainingsweet.Consideringalltheabovefacts,a food recommendation system which recommends food to usersbasedontheirsugarlevels.Rasaisamachinelearning framework for creating AI assistants and chatbots that is opensource.ToworkinRasa,youdon'tusuallyrequireany programming language experience. Although there is a programmecalledRasaActionServerthatrequiresyouto writePythoncode,itisprimarilyintendedtotriggerexternal activitiessuchascallingGoogleAPIsorRESTAPIs.

ThefollowingfigureshowshowtheflowofRasaworks:

1. Theuserreceivesthemessageinthebotwhichis passed to the interpreter. In the interpreter the message is converted into a dictionary which includestheoriginaltext,theintentandtheentities thatwerefound.ThisprocessishandledbyNLU.

2. Tracker is an object which keeps track of conversation state. Tracker will be intimidated whenanewmessagearrives.

3. Policy will receive the current state of tracker. It alsodecideswhichactiontoconsidernext.

4. The chosen action will be logged by tracker as it helps in keeping the track of path or flow of conversation.

5. Responsewillthenbesenttouserwhothenreplies accordingly.

Fig 1:Flowdiagramofproposedsystem

2022, IRJET | Impact Factor value: 7.529 | ISO 9001:2008 Certified Journal

Page2100
©
|

International Research Journal of Engineering and Technology (IRJET) e ISSN: 2395 0056

Volume: 09 Issue: 06 | Jun 2022 www.irjet.net p ISSN: 2395 0072

4. SYSTEM ARCHITECTURE

RASANLU TheuserinputistakenandNLUtriestoinferthe intent and extract the available entities. NLU stands for NaturalLanguageUnderstanding.

afterwhichthepurposeofthetextualcontentisextracted. Entity: An entity represents a time period or item this is applicableinyourintentsandthatgivesaparticularcontext foranpurpose

ThefollowingaretheconfigurationsofRasa:

1. Actions.py code for the custom actions. In case Rasa desires to name outside server thru REST API or API call,itmayoutlinetheCustomActionshere.Itcancreate acoupleofPythonScriptforRasaCustomAction.

2. Config.yml Configuration of NLU and Core models. WhenRasaiscopingwithTensorfloworSpacy,it'sfar described as a pipeline. To deal with this record, the versionmustrealizeapproximatelyMachineLearning andDeepLearning.

Fig 2: RASAFramework

3. Domain.yml This record combines Different Intent which chatbot can hit upon and listing of Bot replies. Rasa can outline the Custom Action Server Python techniquecallhere

Thechatbotisinitiatedaftertheuserlogsintothechatbotto initiate the conversation. After it is initiated, the user can give either give query or response for the questions presentedintheformoftext.Theseresponsesundergopre processing and Natural Language Processing to achieve Tokenizationandextractionofkeywordswhichcorresponds todatabasewhichhelpsinfurtherprocessing.

The keywords are passed to a model which inculcates content basedtechniquesformakingrecommendationsfor userwiththehelpofknowledgebaseormodelwhichhelps inrecommendingbasedonuser’sindividualcharacteristics.

Fig 3: RASAArchitecture

RASACenter Aexchangeadministrationarrangementtries toconstructalikelihooddemonstratewhichchosentheset ofactivitiesto perform based on thepastset ofclientinputsafewcommoncatchphrasesare

•Intent Whatistheclientexpectstoinquireabout?

• What are theimperativepieces ofdatawithin theuser’s query?

•Story Whatistheconceivablewaythediscussioncango?

• Action: Whatactivityought tothe bot take upon aparticularrequest?

RasaNLUstrategiesconsumerentertextualcontentandis familiar with what the consumer is attempting to say. It takestheconsumertextualcontentasenterandextractsthe purposeandentitiesfromit.Intent:Anpurposerepresents themotiveofaconsumer’senter,whattheconsumerdesires todo.Theconsumerentertextualcontentisfirstvectorized

Ifthesystemhasreceivedallthenecessaryinformation,the applicationwillprovidearecommendeddietontheinterface elsefurtherquestionswillbeaskeduntiltherequiredresult canbeinterpreted.

Alltheresponsesareprovidedtouserprimarilyintextual format.Theusercanalsogivetheinputintermsofvoiceas Rasasupportsvoicerecognition.

A.ResponseRetrievalandprocessing:

Theusershouldprovidetothebotwhathe/shewishesto ask the bot. The question then goes for processing. The processwillcontinuetillthechatbothasretrievedresponses and the user does not want to provide any more queries. Oncethesetofinformationisreceived,thesetofresponses undergo textual processing, and the most accurate and appropriateresponseisgiventotheuserbasedonhisquery.

B.Trainingthemodel

Themodelistrainedasetofquestionsandanswer,where thesetofquestionscontainqueries relatedtotypesofdiet,

| Page2101
© 2022, IRJET | Impact Factor value: 7.529 | ISO 9001:2008 Certified Journal

International Research Journal of Engineering and Technology (IRJET) e ISSN: 2395 0056

Volume: 09 Issue: 06 | Jun 2022 www.irjet.net p ISSN: 2395 0072

diabetes, kind of food to be taken when suffering from diabetesandsoonsoforth.ItalsohelpsustofindBMIusing theformula,(weightinkg)/(heightinm)^2.

C.Recommendation

Theproposedmodelisacontent basedrecommendation modelwhichcanidentifythe similaritybetweentheuser andthefooditemsandingredientsbasedontheirnutritional factorsanduser’schoices.

5. RESULTS AND DISCUSSION

“HealthisWealth”isoneofthefamousproverbsinEnglish language.Healthplaysamajorroleinone’slife.Maintaining a proper health depends on the type of food a person consumes.Youngstersthesedaysdon’tpaymuchattention totheirhealthandconsumeallkindsofjunkfood.Thiswill leadtoalotofproblemsinthelatterhalfoftheirperson’s life.Thesystemproposedtriestoprovideefficientdietfora personbasedonvariousparameterslikeheight,weightand thetypeoffoodthepersonwantstoconsume.Thesystem alsofocusesonprovidingarightsetoffoodstyleforpeople suffering from diabetes. The system takes in various personaldetailsalongwithbloodsugarleveloftheuseror patientand givesinvarious diet plansalong with medical dosage if any. All the above features are rendered using a chatbot. Chatbot is great tool for conversation language betweenhumanandmachine.Theapplicationisdeveloped for obtaining a fast response from the bot which helps in providingthecorrectresulttotheuser.

Fig 5: BasicLayoutofBMI

Fig 6: UserLayout

Fig 4: BMICalculator

Fig 7: Result

© 2022, IRJET | Impact Factor value: 7.529 | ISO 9001:2008 Certified Journal | Page2102

International Research Journal of Engineering and Technology (IRJET) e ISSN: 2395 0056

Volume: 09 Issue: 06 | Jun 2022 www.irjet.net p ISSN: 2395 0072

REFERENCES

[1].Dr.DiptiPatil,SurekhaIyer,PoojaMehta,DeeshaGavand, “Dietbot Diet Recommending Chatbot”, April 2021| IJIRT|Volume7Issue11|ISSN:2349 6002

[2].FaisalRehman,OsmanKhalid,Nuhmanul Haq,Atta ur RehmanKhan,KashifBilal,andSajjadA.Madani,“Dier Right: A Smart Food Recommendation System”, KSII TransactionsOnInternetAndInformationSystemsVOL. 11,NO.6,Jun.2017.

[3].Kavitha B. R, Dr. Chethana R. Murthy, “Chatbot for healthcare system using Artificial Intelligence” ISSN: 2454 132XImpactfactor:4.295(Volume5,Issue3).

Fig 8: BasicConversationbetweenBotandUser

6. CONCLUSION AND FUTURE ENHANCEMENTS

Consumptionofhealthyandnutritiousfoodisessentialfora person to maintain a healthy body. Food provides us essentialnutrientsandvitaminslikecarbohydrate,proteins, fatsandminerals.alltheabove mentionednutrientswillbe producedifapersonconsumesrightsetofnutritiousfoodor maintainsahealthydiet.Thesystemproposedprovidesthe userarecommendationonwhattypeoffoodapersonhasto consume to maintain a healthy body. This system mainly focusesondiabetesandthesystemisinculcatedbyachatbot throughwhichtheusercaninteractandreceiverightsetof dietforwhichapersoncanmaintainhissugarlevels.This systemtriestoreducethetimespanandcostoftheuser.The focusofthissystemistoincludeachatbotwhichprovides healthy diet suggestions or recommendations for users sufferingfromdiabetesandalsoprovidesahealthydietfor peopletomaintaintheirhealth

The future is the era of messaging app because of which people spend longer time on messaging apps rather than other apps. The proposed system mainly focuses on calculating BMI and providing a healthy diet to patients sufferingfromdiabetes.The systemcanbeimprovised by providingfoodrecommendationformultiplediseasessuch as blood pressure, asthma, hypertension. Currently, the systemonlyfocusesonEnglishandnootherlanguage.Other language options can also be provided for the user to communicatewiththechatbot.Thesystemcanalsoinclude voice inputs from different languages. The system is designed as an application on phone. It can also be integratedasaweb basedapplication.Thesystemcanalso beaddedwithextrafeatureslikecaloriemeter,whichwill calculatetheamountofcaloriesconsumedbytheuserdaily. It can also include various diet plans like Keto diet, Paleo diet,Vegandiet,andotherdiets.

[4].Noppon Siangchin, Taweesak Samanchuen, “Chatbot Implementation for ICD 10 Recommendation System”, TechnologyofInformationSystemManagementDivision, Faculty of Engineering, Mahidol University, Nakhon Pathom,Thailand,73170.

[5].Ahmed Fadhil, “Can a Chatbot Determine My Diet?: AddressingChallengesofChatbotApplicationforMeal Recommendation”, University of Trento, Italy, March 2007.

[6].Farhin Mansur, Vibha Patel, Mihir Patel, “A Review on RecommenderSystems”,ResearchGate,March2017.

[7].N.Naveenkumar, M.Hemanth Reddy, S.Sai Nikitha T.SaiRam Reddy, “Human Chatbot Interaction Using NLTK”, International Journal Of Creative Research Thoughts IJCRT,Volume8,Issue2February2020.

[8].GitHub CI,“Rasa Architecture”, https://rasa.com /docs/rasa/architecture/

[9].Kavinda Senarathne, “Rasa Architecture for Clever Chatbots”,https://rb,gy/xp9mqr,medium,2020

[10]. Usman,”BuildingaRasaChatbotonGoogleColab”, https://medium.com/analytics vidhya/building a rasa chat bot on google colab 2ff6ac02dd26

[11]. Mohd Sanad Zaki Rizvi, “Learn how to Build and Deploy a Chatbot in Minutes using Rasa”, https://medium.com/analytics vidhya/learn how to build and deploy a chatbot in minutes using rasa 5787fe9cce19

[12]. Sandip Plait, “Build a chatbot using Rasa”, https://medium.com/analytics vidhya/build a chatbot using rasa 78406306aa0c

[13]. BikashSundaray,“CreateChatbotusingRasaPart 1”, https://towardsdatascience.com/create chatbot using rasa part 1 67f68e89ddad

©
Page2103
2022, IRJET | Impact Factor value: 7.529 | ISO 9001:2008 Certified Journal |

Turn static files into dynamic content formats.

Create a flipbook