BookRecommender is an iOS app, that helps book readers to choose their next
books to read.
Basically, this app has two main features:
- Based on the user’s tastes, the system will recommend other books through a trained machine learning model;
- The user can select the recommended books to see their description and their preview, so that they can easily understand if the plot and the style of the book are among the user’s tastes.
- Rate the books you have read and tap Continue;
- Select one of the recommended books;
- Read the description and tap Preview;
- Enjoy your reading!
Click here to watch the demo.
The machine learning model is based on collaborative filtering and it was created by CreateML, a powerful framework
of Apple that make easy the creation of a trained model. In this case,
it was enough to give a small dataset. Check it out Dataset file.
The model was managed with CoreML. See Recommender file for details.
To have the description of a book and (if it’s available) its preview, it was used Google Books API. With public searches it's not even need an API key.
It was managed through the BookJSON file. You can find the struct of the book to decode the JSON and its function.
The function loadData(isbn: String)
will send the request to Google Books' servers to fetch book informations. It will return its description and its webReader link to see the preview.
Since the dataset is small, the database containing the books informations
(link of the cover image, ISBN, name) is local, making faster the loading of
the informations. Check it out BookDB file.
The database is loaded when the app starts to run. See BookRecommenderApp file.
- The first view is BookRatingView which loads books from database and shows them through a
LazyVGrid
in which each grid item is a BookView. The view instantiates a Recommender object. Once rated, when the button Continue is pressed, the Recommender's functionload
is called and every rating is taken and processed; - The next view is RecommendView that shows recommended books by the ML model. Each grid item is a BookView with the boolean condition
isRated=true
so that the same view can be reused: rating stars are hidden and each book can be tapped to go to the next view; - When a recommended book is tapped, it appears BookDescriptionView. In this view is possible to see the description of the tapped book and its preview, loaded from the function
loadData(isbn: String)
. - Once pressed the button Preview, the app redirects to the book preview web page offered by Google Books;
This project is licensed under the GPL-3.0 License - see the LICENSE.md file for details.