-
Notifications
You must be signed in to change notification settings - Fork 0
Guide learners from cards to active recall #151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| """Post-lesson reinforcement keeps learners moving without another chooser.""" | ||
|
|
||
| import os | ||
| import unittest | ||
|
|
||
| os.environ.setdefault("BOT_TOKEN", "123456:TESTTOKEN_ABCDEFGHIJKLMNOP") | ||
| os.environ.setdefault("ALLOWED_USER_ID", "1") | ||
| os.environ.setdefault("ALLOW_SQLITE_DEV", "true") | ||
|
|
||
| import bot | ||
| from mydictionary.localization import INTERFACE_LOCALES, translate | ||
|
|
||
|
|
||
| def buttons(markup): | ||
| return [button for row in markup.inline_keyboard for button in row] | ||
|
|
||
|
|
||
| class PostLessonReinforcementTest(unittest.TestCase): | ||
| def completed(self, mode: str, *, wrong: list[int] | None = None, locale: str = "en"): | ||
| state = {"interface_locale": locale} | ||
| bot.reset_block_state( | ||
| state, | ||
| [0, 1, 2], | ||
| "ja", | ||
| None, | ||
| "ja-basics-100", | ||
| lesson_kind="daily", | ||
| ) | ||
| bot.start_block_attempt(state, mode) | ||
| mistakes = list(wrong or []) | ||
| state.update( | ||
| block_pos=3, | ||
| block_correct=3 - len(mistakes), | ||
| block_wrong=mistakes, | ||
| ) | ||
| return state | ||
|
|
||
| def test_perfect_cards_offer_quiz_on_the_same_words(self): | ||
| state = self.completed("flash") | ||
|
|
||
| inline = buttons(bot.build_block_summary_keyboard(state)) | ||
|
|
||
| self.assertLessEqual(len(inline), 3) | ||
| self.assertEqual( | ||
| inline[0].callback_data, | ||
| f"bmode:{state['block_session']}:quiz", | ||
| ) | ||
| self.assertEqual(inline[0].text, translate("block_reinforce_quiz", "en")) | ||
|
|
||
| def test_perfect_quiz_offers_written_recall_on_the_same_words(self): | ||
| state = self.completed("quiz", locale="ru") | ||
|
|
||
| inline = buttons(bot.build_block_summary_keyboard(state)) | ||
|
|
||
| self.assertLessEqual(len(inline), 3) | ||
| self.assertEqual( | ||
| inline[0].callback_data, | ||
| f"bmode:{state['block_session']}:type", | ||
| ) | ||
| self.assertEqual(inline[0].text, translate("block_reinforce_written", "ru")) | ||
|
|
||
| def test_perfect_written_practice_still_offers_another_lesson(self): | ||
| state = self.completed("type") | ||
|
|
||
| inline = buttons(bot.build_block_summary_keyboard(state)) | ||
|
|
||
| self.assertEqual(inline[0].callback_data, "start:daily") | ||
| self.assertEqual(inline[0].text, translate("block_another_lesson", "en")) | ||
|
|
||
| def test_errors_keep_retry_first_in_every_mode(self): | ||
| for mode in ("flash", "quiz", "type"): | ||
| with self.subTest(mode=mode): | ||
| state = self.completed(mode, wrong=[1]) | ||
| inline = buttons(bot.build_block_summary_keyboard(state)) | ||
| self.assertLessEqual(len(inline), 3) | ||
| self.assertEqual( | ||
| inline[0].callback_data, | ||
| f"bretry:{state['block_session']}", | ||
| ) | ||
|
|
||
| def test_reinforcement_copy_exists_for_every_interface_locale(self): | ||
| for locale in INTERFACE_LOCALES: | ||
| with self.subTest(locale=locale): | ||
| self.assertTrue(translate("block_reinforce_quiz", locale).strip()) | ||
| self.assertTrue(translate("block_reinforce_written", locale).strip()) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| unittest.main() |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a learner follows the new primary actions after perfect cards and quiz attempts, both callbacks start fresh, normally scored attempts over
block_all_indices; each correct answer therefore runs throughblock_advance/bot_learning.rateand increments the same word'scorrect_count. A brand-new word can consequently go from 0 to 3 and receive a seven-day interval during one uninterrupted lesson, immediately satisfying the canonical “durable word” metric and postponing its first spaced review. These same-session reinforcement attempts need separate/non-SRS scoring, or otherwise must not advance the interval as independent reviews.AGENTS.md reference: AGENTS.md:L10-L12
Useful? React with 👍 / 👎.