Explanation for python code that uses defaultdic library and simpleai package to build a Disease Recommendation System

This code makes a Disease Recommendation System . I’m having difficulty in understanding code from lines 14-23 in which defaultdict library is used and then from lines 26 - 39 in which python package simpleai is used. Below is the link to the code:


What do you not understand?
A “defaultdic” is a special Python object - it creates a dictionairy with a “default” value that is used whenever a non-existent entry is called.
In this case a list → thus they can use “.append()” without running into an error.
It’s kinda like using “dict.get(value, list())” whenever accessing a value for dict.

As for the simpleai… well again, what’s the problem? It’s appearently a library for some AI. So go look at the documentation about it?