{"id":24216662,"url":"https://github.com/martinstyk/quotes-recommender","last_synced_at":"2025-06-29T06:06:31.249Z","repository":{"id":78408157,"uuid":"104903338","full_name":"MartinStyk/quotes-recommender","owner":"MartinStyk","description":"Project for course PV254 Recommender Systems. Web application for recommending quotes","archived":false,"fork":false,"pushed_at":"2017-12-12T22:53:21.000Z","size":1079,"stargazers_count":4,"open_issues_count":2,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-11T20:15:59.833Z","etag":null,"topics":["quotes","recommendation-system","recommender-system","school-project","web-application"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MartinStyk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-09-26T15:29:22.000Z","updated_at":"2024-08-31T15:59:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"8202306e-4487-49ac-bff7-67cffd9bda55","html_url":"https://github.com/MartinStyk/quotes-recommender","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/MartinStyk/quotes-recommender","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MartinStyk%2Fquotes-recommender","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MartinStyk%2Fquotes-recommender/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MartinStyk%2Fquotes-recommender/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MartinStyk%2Fquotes-recommender/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MartinStyk","download_url":"https://codeload.github.com/MartinStyk/quotes-recommender/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MartinStyk%2Fquotes-recommender/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262545031,"owners_count":23326658,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["quotes","recommendation-system","recommender-system","school-project","web-application"],"created_at":"2025-01-14T04:33:14.272Z","updated_at":"2025-06-29T06:06:31.242Z","avatar_url":"https://github.com/MartinStyk.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Quotes Recommender\nProject for course PV254 Recommender Systems. Web application for recommending quotes\n\nThe aim of this project is to implement recommendation algorithms. Database of quotes was obtained from https://www.brainyquote.com. \nWeb app is implemented in Ruby on Rails.\n\n## Contributors\n* [Vojtech Hlavka](https://github.com/vojtechhlavka) \n  * Data analysis\n  * Data filtering\n  * Evaluation\n  * Charts and graphs\n* [David Luptak](https://github.com/DavidLuptak) \n  * Implementation of web app\n    * Complete web app skeleton\n    * Deployment on public domain\n    * User interface\n    * Authentication\n  * Implementation of recommendation algorithms\n  * Final presentation\n* [Martin Styk](https://github.com/MartinStyk) \n  * Download of quotes database by scraping website www.brainyquote.com\n  * Implementation of recommendation algorithms\n  * Implementation of web app\n    * Integration of recommendation algorithms \n  * Final presentation\n\n## Project structure\nProject has well known Ruby on Rails app structure.\n\n#### Controllers\nControllers which handle HTTP requests are located inside [app/controllers](./app/controllers) directory.\n\nControllers important for recommendations\n* [ratings_controller](./app/controllers/ratings_controller.rb) - method ``update`` is triggered when user enters a rating for a quote.  It handles insert of new rating or change of existing rating. ``update``  method triggers methods ``adjust_user_category_preference, adjust_user_quote_length_preference, adjust_user_word_length_preference``. These methods update user's profile everytime user rates a quote. This is the place where user's profile is built.\n\n* [home_controller](./app/controllers/home_controller.rb) - method ``index`` is triggered everytime when user wants to see a new quote. It parses request params and triggers quote selection algorithms on line [12](./app/controllers/home_controller.rb#L12). Category parameter is only used on first random quote selection. For all other quotes line [12](./app/controllers/home_controller.rb#L12) is executed.\n\n\n#### Interactors\nInteractors which are important for recommendations, located in [app/interactors](./app/interactors) directory.\n\n* [initialize_quote](./app/interactors/initialize_quote.rb) - this interactor is triggered from home_controller. It delegates recommendation work to [recommend_quote](./app/interactors/recommend_quote.rb) interactor.\n\n* [recommend_quote](./app/interactors/recommend_quote.rb) - chooses the recommendation algorithm based on user which invoked the method.\n\n#### Services\nRecommendation logic is implemented in service classes located in [app/services](./app/services) directory.\nThis is a list of all recommender services, you can find additional comments directly in source code classes.\n\n* [recommender_service](./app/services/recommender_service.rb) - super class of all recommender service classes. It defines method ``show_next`` which is called by class clients. Method ``choose_next_quote`` is meant to be overriden by subclasses and returns the quote which should be shown.\n\n* [anonymous_recommender_service](./app/services/anonymous_recommender_service.rb) - service is used when user is not logged in. We don't know user's profile, so random quote is returned and entry about user activity on site is not saved.\n\n* [random_recommender_service](./app/services/random_recommender_service.rb) -  Method ``choose_next_quote`` returns random quote.\n\n* [score_board_recommender_service](./app/services/score_board_recommender_service.rb) - base class for all advanced recommenders - ``global_popularity_recommender_service`` and classes based on its child ``learning_score_board_recommender_service``, which compute score board (quote -\u003e score - suitability for user). It overrides `choose_next_quote` method of ``recommender_service``. Inside this method, abstract method ``compute_score_board`` is triggered. This method is meant to be overriden by subclasses. It should return result - scoreboard of quotes ordered and normalized. Top results are then shuffled in method ``score_board_recommender_service#choose_next_quote``. Please see comments directly in the [score_board_recommender_service](./app/services/score_board_recommender_service.rb) class.\n\n* [global_popularity_recommender_service](./app/services/global_popularity_recommender_service.rb) - extends ``score_board_recommender_service`` and overrides method ``compute_score_board`` to compute score of quotes based on their global popularity.\n\n* [learning_score_board_recommender_service](./app/services/learning_score_board_recommender_service.rb) - slightly changes behaviour of ``score_board_recommender_service`` - if user has seen less then 5 quotes, it returns random quote. All other logic is delegated to it's predecessor ``score_board_recommender_service``. This is parent class for ``content_based_category_recommender_service, content_based_quote_analysis_recommender_service, content_based_mixed_recommender_service``.\n\n* [content_based_category_recommender_service](./app/services/content_based_category_recommender_service.rb) - computes scoreboard of quotes based on user's profile for categories. See comments in the source file.\n\n* [content_based_quote_analysis_recommender_service](./app/services/content_based_quote_analysis_recommender_service.rb\n) - computes scoreboard of quotes based on user's profile for text style. See comments in the source file.\n\n* [content_based_mixed_recommender_service](./app/services/content_based_mixed_recommender_service.rb) - combines ``content_based_category_recommender_service`` and  ``content_based_quote_analysis_recommender_service``. It merges scoreboards computed by these services. Category has priority with 80% in final score, while text style has only 20%.\n\n#### List of other important files\n\n* Database schema - [db/schema.rb](./db/schema.rb)\n\n* Script for quotes download - [scripts/quotes_finder.rb](./scripts/quotes_finder.rb)\n\n* Quotes data (original and filtered) - [data](./data) directory\n\n## Execution \u0026 development\n\n### Environment preparation\n\nIn order to set up your environment please follow the instructions provided [here](https://github.com/municz/study-materials/wiki/Environment-preparation-%28cs%29). It contains these main steps:\n\n* Install required dependencies\n* (Optionally) Install rbenv\n* Install ruby ([official documentation](https://www.ruby-lang.org/en/documentation/installation/))\n* Install `rails` and `bundler` (or other useful gems)\n\n### Development\n\n* `cd` to the root directory of the project\n* Run `bundle install` to install missing gems\n* Run `rails db:migrate` to initialize the database schema\n* Run `rails db:seed` to insert data into the database\n* Run `rails server` \u003e\u003e \u003chttp://localhost:3000/\u003e\n\n### Setup\n\n#### Admin\n\nTo initialize an _admin_ user in the system, run the following:\n\n* `cd` to the root directory of the project\n* Run `rails console` to start console for rails\n* Create a user and add an admin role:\n\n```ruby\n\u003e user = User.new\n\u003e user.email = 'admin@admin.admin'\n\u003e user.password = 'adminadmin'\n\u003e user.add_role :admin\n\u003e user.save\n# Because _user_ default role is assigned after create\n\u003e user.remove_role :user\n```\n* You are done. (You can leave the `console` by pressing `Ctrl^D`)\n\n#### Google authentication\n\nExporting the following environment variables is needed to use Google authentication\n```\nGOOGLE_CLIENT_ID = \u003cyour client ID\u003e\nGOOGLE_CLIENT_SECRET = \u003cyour client secret\u003e.\n```\n\n#### Facebook authentication\n\nExporting the following environment variables is needed to use Facebook authentication\n```\nAPP_ID = \u003cyour application ID\u003e\nAPP_SECRET \u003cyour application secret\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartinstyk%2Fquotes-recommender","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmartinstyk%2Fquotes-recommender","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartinstyk%2Fquotes-recommender/lists"}