{"id":15724320,"url":"https://github.com/cedlemo/lobotomy","last_synced_at":"2025-06-14T15:33:33.913Z","repository":{"id":7212664,"uuid":"8518809","full_name":"cedlemo/lobotomy","owner":"cedlemo","description":"Create cli quizzes and force your brain","archived":false,"fork":false,"pushed_at":"2013-12-31T10:44:44.000Z","size":2560,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-31T01:14:12.040Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cedlemo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-03-02T10:08:55.000Z","updated_at":"2015-11-09T20:37:55.000Z","dependencies_parsed_at":"2022-08-24T20:11:44.443Z","dependency_job_id":null,"html_url":"https://github.com/cedlemo/lobotomy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cedlemo/lobotomy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cedlemo%2Flobotomy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cedlemo%2Flobotomy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cedlemo%2Flobotomy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cedlemo%2Flobotomy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cedlemo","download_url":"https://codeload.github.com/cedlemo/lobotomy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cedlemo%2Flobotomy/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259838156,"owners_count":22919532,"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":[],"created_at":"2024-10-03T22:16:09.965Z","updated_at":"2025-06-14T15:33:33.879Z","avatar_url":"https://github.com/cedlemo.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"##Lobotomy\n\n###Create cli quizzes and force your brain:\nLobotomy is a module that helps you to create little quizzes, for terminal emulator, based on data in a text file.\n\n###Install:\nGet current version:\n\n    git clone git://github.com/cedlemo/lobotomy.git\n\nCreate the gem:\n\n    cd lobotomy\n    gem build lobotomy.gemspec\n\nInstall lobotomy for the current user:\n\n    gem install lobotomy-*.gem\n\n###Lobotomy overview:\nWhen I started learning Japanese, I needed a tool that helps me to quickly create little quizzes in order to learn things and to check what I have learned .\n\nlobotomy read a text file which contains data and is formated like this:\n\n    #word romaji\n    shoe|kutsu\n    sock|kutsushita\n    house|uchi\n\nUser create a new Lobotomy::Quiz class that load this file and generate a new quiz. User can see his stats and save them.\n\n###Examples:\nCode examples for a simple quiz and more advanced ones.\n\n####Simple example:\nHere is a simple quiz that just displays if your answer is good or wrong.\n\nWith the file vocab.list :\n\n    #word romaji\n    shoe|kutsu\n    sock|kutsushita\n    house|uchi\n\nCreate a new ruby script called vocab_quizz.rb\n\n    #!/usr/bin/env ruby\n    require 'lobotomy'\n    \n    quiz_name = \"vocab_quiz\"\n    data_file = \"./vocab.list\"\n    symbols = [:word, :romaji]\n    column_separator = \"\\|\"\n    column_sub_separator = nil\n    nb_questions = 10\n\n    quiz = Lobotomy::Quiz.new( quiz_name, data_file, symbols, column_separator, column_sub_separator )\n\n    #The quiz will use the word column in order to create the question and the answer are checked with the romaji column.\n\t\t#quiz.question_symbol will be filled with  :word\n    #quiz.answer_symbol will be filled with :romaji\n    \n    quiz.question_is_word_answer_is_romaji()\n    \n\t\tquiz.on_bad_answer do\n      puts \"Wrong\".red\n    end\n\n    quiz.on_good_answer do\n      puts \"Good\".green\n    end\n\n    quiz.launch(nb_questions)\n\n####Quiz with more customization:\n\nThe data file is kanas.list:\n\n    #romaji hiragana katakana\n    a あ ア\n    i い イ\n    u う ウ\n    ...\n\nThere are mp3 files in the kanas_sounds directory that correspond to the sound of each kanas.\n\nThe associated ruby script is kanas_quiz.rb (in examples/):\n\nWe create a new Quiz class that load the file kanas.list, with \"kanas_quiz\" as the quiz name. The symbols we define corresponds of the column names in our data file.\nThe separator we use is the \"space\" char. No sub separator is given because we don't have multiple data in each columns' \n\n    kanas_file = \"kanas.list\"\n    stats_directory=\"/home/\" +ENV['USER']+\"/.lobotomy/stats\"\n    quiz = Lobotomy::Quiz.new(\"kanas_quiz\", kanas_file, [:romaji,:hiragana,:katakana],\"\\s\",nil)\n\nHere is the basic and mandatory configuration of the script:\n\n    #define the column hiragana used as the question value\n    #define the column romaji used as the answer value (it's this value that is checked with the user answer)\n    quiz.question_is_hiragana_answer_is_romaji()\n\nThis part is optional but help to have a more customized quiz.\n\nModify the question label. User can customize the question label with a model. In this model if you use one or more symbols ( the same defined above) those symbols are substitued by the current value when the question is build.\nUser can modify colors of a part of the string. Lobotomy module extends the String class with new methods (bold, underline, reversed, black, red, green, yellow, blue, magenta, cyan) when you use require 'lobotomy' \n\n    quiz.question_label(\":hiragana\".blue + \" ?\")\n\nYou can define the directory where the stats will be saved/loaded \n\n    quiz.stats_dir = stats_directory\n\nIt 's possible to associate code for the two main events of a quiz which are good answer or bad answer:\n\nJust use the methods on_bad_answer() and on_good_answer() and feed them with ruby blocks. You can access the current random entry taken from the full set of data with quiz.random_entry. Look at the code of the examples.\n\nHere we define a block for the bad answer event. If the user answer is wrong, we display information.\nThen we check if the user answer correspond to something in the data.\nAt the end, we play a media file and wait for user input in order to continue the quizz.\n\n    quiz.on_bad_answer do\n      puts \"\\t!!! Wrong\".bold.yellow + \" #{quiz.random_entry[:hiragana]}\".blue + \" =\u003e \" + \"#{quiz.random_entry[:romaji]}\".cyan\n      #find is user input correspond to another word\n      print \"\\t\\t\"\n      quiz.data.each do | entry |\n        if entry[quiz.answer_symbol].match(/^#{quiz.user_answer}$/)\n          print \"you mistake #{quiz.random_entry[:hiragana]} for #{entry[quiz.question_symbol].black} =\u003e #{entry[quiz.answer_symbol].black}.\"\n        end\n      end\n      system(\"mplayer kanas_sounds/#{quiz.random_entry[:romaji]}.mp3 \u003e /dev/null 2\u003e\u00261\")\n      print \" Continue ...(hit Return)\"\n      STDIN.gets\n    end\n\nIn the block for the good answer event we just display in green the \"--Good !!!--\" string. Play a media file and wait for user input\n\n    quiz.on_good_answer do\n      print \"\\t:--Good !!!--\".green \n      system(\"mplayer kanas_sounds/#{quiz.random_entry[:romaji]}.mp3 \u003e /dev/null 2\u003e\u00261\")\n      print \"  Continue ...(hit Return)\"\n      STDIN.gets\n    end\n\nThen we allow user to see some of his stats or error:\n\n    puts \"Do you want to see your difficulties?\".black\n    if STDIN.gets.chomp.match(/[yY]/)\n    \n      quiz.results.each do | entry |\n        if entry[:stats].length != 0\n          good=0\n          bad = 0\n          entry[:stats].each do | stats |\n            if stats[:good] == true\n              good += 1\n            else\n              bad += 1\n            end\n          end\n          if bad \u003e good\n            puts \"* \".black + entry[:hiragana].magenta + \" =\u003e \" + entry[:romaji].bold.red \n          end\n        end\n      end\n    end\n\n####Quiz with multiple data in columns:\n\nYou can have multiple data in each columns. Lobotomy can deals with this!\n\nExample vocabulary.list:\n\n    #romaji|kanas\n    house|いえ/うち\n    ox/cow|うし\n\nThe creation of a new Quiz class for this file will be done with:\n\n    Lobotomy::Quiz.new(\"vocabulary_quiz\", \"vocabulary.list\", [:romaji,:kana],\"\\|\",\"\\/\")\n\nThat's all. You just have to be carefull when you are using quiz.random_entry. With sub separator, each data in a column have been put in an array:\n\n    quiz.random_entry.inspect =\u003e {:romaji =\u003e \"house\", :kana =\u003e [\"うち\",\"いえ\"]}\n    quiz.random_entry.inspect =\u003e {:romaji =\u003e [\"ox\",\"cow\"], :kana =\u003e \"うし\"}\n\ncedlemo at gmx dot com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcedlemo%2Flobotomy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcedlemo%2Flobotomy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcedlemo%2Flobotomy/lists"}