rairo commited on
Commit
c4a71c5
·
verified ·
1 Parent(s): 3922b40

Update content_pack.py

Browse files
Files changed (1) hide show
  1. content_pack.py +327 -1
content_pack.py CHANGED
@@ -349,4 +349,330 @@ def get_verbs(pack: dict = None) -> list:
349
 
350
  def get_adjectives(pack: dict = None) -> list:
351
  pack = pack or get_active_pack()
352
- return [v for v in pack["vocab"] if v["type"] == "adjective"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
349
 
350
  def get_adjectives(pack: dict = None) -> list:
351
  pack = pack or get_active_pack()
352
+ return [v for v in pack["vocab"] if v["type"] == "adjective"]
353
+
354
+
355
+ # ---------------------------------------------------------------------------
356
+ # LESSON CONTENT — Explanation, Example Sentences, Speaking Sentences
357
+ # ---------------------------------------------------------------------------
358
+ # Each grammar rule gets:
359
+ # explanation — what Unity shows in Frame 1 (text) + Frame 2 (pattern)
360
+ # example_sentences — 2-4 pairs (positive + negative) for Frame 3
361
+ # speaking_sentences — sentences for Frame 5 (user repeats aloud)
362
+ # ---------------------------------------------------------------------------
363
+
364
+ LESSON_CONTENT = {
365
+ "topic_marker": {
366
+ "explanation": {
367
+ "title": "Topic Markers 은/는",
368
+ "body": (
369
+ "Used to mark the topic of a sentence. "
370
+ "은 attaches to nouns that end with a consonant (받침). "
371
+ "는 attaches to nouns that end with a vowel."
372
+ ),
373
+ "pattern": "N (Consonant) + 은 / N (Vowel) + 는",
374
+ "notes": "The topic marker tells the listener what the sentence is about.",
375
+ },
376
+ "example_sentences": [
377
+ {
378
+ "positive": {"korean": "저는 학생이에요.", "english": "I am a student."},
379
+ "negative": {"korean": "저는 학생이 아니에요.", "english": "I am not a student."},
380
+ "focus_word": "저는",
381
+ "rule_shown": "저 (vowel ending) + 는",
382
+ },
383
+ {
384
+ "positive": {"korean": "이것은 책이에요.", "english": "This is a book."},
385
+ "negative": {"korean": "이것은 책이 아니에요.", "english": "This is not a book."},
386
+ "focus_word": "이것은",
387
+ "rule_shown": "이것 (consonant ending ㅅ) + 은",
388
+ },
389
+ {
390
+ "positive": {"korean": "친구는 의사예요.", "english": "My friend is a doctor."},
391
+ "negative": {"korean": "친구는 의사가 아니에요.", "english": "My friend is not a doctor."},
392
+ "focus_word": "친구는",
393
+ "rule_shown": "친구 (vowel ending) + 는",
394
+ },
395
+ ],
396
+ "speaking_sentences": [
397
+ {"korean": "저는 학생이에요.", "english": "I am a student.", "difficulty": 1},
398
+ {"korean": "이것은 사과예요.", "english": "This is an apple.", "difficulty": 1},
399
+ {"korean": "선생님은 친절해요.", "english": "The teacher is kind.", "difficulty": 2},
400
+ {"korean": "우리는 친구예요.", "english": "We are friends.", "difficulty": 2},
401
+ ],
402
+ },
403
+
404
+ "copula": {
405
+ "explanation": {
406
+ "title": "Copula 이에요/예요",
407
+ "body": (
408
+ "Used to say 'N1 is N2'. "
409
+ "이에요 attaches to nouns ending with a consonant. "
410
+ "예요 attaches to nouns ending with a vowel."
411
+ ),
412
+ "pattern": "N (Consonant) + 이에요 / N (Vowel) + 예요",
413
+ "notes": "이에요/예요 is the polite present tense of the copula (to be).",
414
+ },
415
+ "example_sentences": [
416
+ {
417
+ "positive": {"korean": "저는 학생이에요.", "english": "I am a student."},
418
+ "negative": {"korean": "저는 학생이 아니에요.", "english": "I am not a student."},
419
+ "focus_word": "학생이에요",
420
+ "rule_shown": "학생 (consonant ending ㅇ) + 이에요",
421
+ },
422
+ {
423
+ "positive": {"korean": "제 이름은 민수예요.", "english": "My name is Minsu."},
424
+ "negative": {"korean": "제 이름은 민수가 아니에요.", "english": "My name is not Minsu."},
425
+ "focus_word": "민수예요",
426
+ "rule_shown": "민수 (vowel ending) + 예요",
427
+ },
428
+ {
429
+ "positive": {"korean": "이것은 커피예요.", "english": "This is coffee."},
430
+ "negative": {"korean": "이것은 커피가 아니에요.", "english": "This is not coffee."},
431
+ "focus_word": "커피예요",
432
+ "rule_shown": "커피 (vowel ending) + 예요",
433
+ },
434
+ ],
435
+ "speaking_sentences": [
436
+ {"korean": "저는 선생님이에요.", "english": "I am a teacher.", "difficulty": 1},
437
+ {"korean": "이것은 물이에요.", "english": "This is water.", "difficulty": 1},
438
+ {"korean": "제 친구는 의사예요.", "english": "My friend is a doctor.", "difficulty": 2},
439
+ {"korean": "저는 한국어 학생이에요.", "english": "I am a Korean language student.", "difficulty": 2},
440
+ ],
441
+ },
442
+
443
+ "negative_copula": {
444
+ "explanation": {
445
+ "title": "Negative Copula 이/가 아니에요",
446
+ "body": (
447
+ "Used to say 'N1 is not N2'. "
448
+ "이 아니에요 attaches after consonant-ending nouns. "
449
+ "가 아니에요 attaches after vowel-ending nouns or nouns ending in ㄹ."
450
+ ),
451
+ "pattern": "N (Consonant) + 이 아니에요 / N (Vowel/ㄹ) + 가 아니에요",
452
+ "notes": "이/가 is the subject marker. 아니에요 means 'is not'.",
453
+ },
454
+ "example_sentences": [
455
+ {
456
+ "positive": {"korean": "이것은 물이에요.", "english": "This is water."},
457
+ "negative": {"korean": "이것은 물이 아니에요.", "english": "This is not water."},
458
+ "focus_word": "물이 아니에요",
459
+ "rule_shown": "물 (consonant ending ㄹ) → 가 아니에요",
460
+ },
461
+ {
462
+ "positive": {"korean": "저는 학생이에요.", "english": "I am a student."},
463
+ "negative": {"korean": "저는 학생이 아니에요.", "english": "I am not a student."},
464
+ "focus_word": "학생이 아니에요",
465
+ "rule_shown": "학생 (consonant ending ㅇ) + 이 아니에요",
466
+ },
467
+ {
468
+ "positive": {"korean": "이분은 의사예요.", "english": "This person is a doctor."},
469
+ "negative": {"korean": "이분은 의사가 아니에요.", "english": "This person is not a doctor."},
470
+ "focus_word": "의사가 아니에요",
471
+ "rule_shown": "의사 (vowel ending) + 가 아니에요",
472
+ },
473
+ ],
474
+ "speaking_sentences": [
475
+ {"korean": "이것은 책이 아니에요.", "english": "This is not a book.", "difficulty": 1},
476
+ {"korean": "저는 선생님이 아니에요.", "english": "I am not a teacher.", "difficulty": 1},
477
+ {"korean": "그것은 커피가 아니에요.", "english": "That is not coffee.", "difficulty": 2},
478
+ {"korean": "이분은 제 친구가 아니에요.", "english": "This person is not my friend.", "difficulty": 2},
479
+ ],
480
+ },
481
+
482
+ "indirect_quote_dago": {
483
+ "explanation": {
484
+ "title": "Indirect Quotation -다고",
485
+ "body": (
486
+ "Used to report what someone said (statements). "
487
+ "Verb stems use 는다고 (action verbs) or ㄴ다고 (vowel-ending stems). "
488
+ "Adjectives and 이다 use 다고. Past tense uses 었/았다고."
489
+ ),
490
+ "pattern": "V-stem + 는다고/ㄴ다고 | Adj + 다고 | V(past) + 었/았다고",
491
+ "notes": "했어요 (said) or 해요 (says) follows 다고 in most sentences.",
492
+ },
493
+ "example_sentences": [
494
+ {
495
+ "positive": {"korean": "민수가 '등록금이 너무 비싸요.'라고 했어요.", "english": "Minsu said 'The tuition is too expensive.'"},
496
+ "negative": {"korean": "민수는 등록금이 너무 비싸다고 했어요.", "english": "Minsu said that the tuition is too expensive."},
497
+ "focus_word": "비싸다고",
498
+ "rule_shown": "비싸다 (adjective) + 다고",
499
+ },
500
+ {
501
+ "positive": {"korean": "친구가 '공부해요.'라고 했어요.", "english": "My friend said 'I study.'"},
502
+ "negative": {"korean": "친구가 공부한다고 했어요.", "english": "My friend said that they study."},
503
+ "focus_word": "공부한다고",
504
+ "rule_shown": "공부하다 → 공부한다고 (하 drops, ㄴ다고)",
505
+ },
506
+ ],
507
+ "speaking_sentences": [
508
+ {"korean": "친구가 피곤하다고 했어요.", "english": "My friend said they are tired.", "difficulty": 2},
509
+ {"korean": "선생님이 숙제가 많다고 했어요.", "english": "The teacher said there is a lot of homework.", "difficulty": 2},
510
+ {"korean": "민수가 내일 학교에 간다고 했어요.", "english": "Minsu said they are going to school tomorrow.", "difficulty": 3},
511
+ ],
512
+ },
513
+
514
+ "indirect_quote_commands": {
515
+ "explanation": {
516
+ "title": "Indirect Quotation — Commands",
517
+ "body": (
518
+ "(으)라고 is used to report commands or requests. "
519
+ "지 말라고 is used to report negative commands (telling someone not to do something). "
520
+ "달라고 reports requests (please give/do for me). 주라고 reports 'please do'."
521
+ ),
522
+ "pattern": "V-stem + (으)라고 | V + 지 말라고 | 달라고 / 주라고",
523
+ "notes": "The subject marker after the speaker is 이/가.",
524
+ },
525
+ "example_sentences": [
526
+ {
527
+ "positive": {"korean": "선생님이 '조용히 하세요.'라고 했어요.", "english": "The teacher said 'Please be quiet.'"},
528
+ "negative": {"korean": "선생님이 조용히 하라고 했어요.", "english": "The teacher told us to be quiet."},
529
+ "focus_word": "하라고",
530
+ "rule_shown": "하다 (vowel stem) + 라고",
531
+ },
532
+ {
533
+ "positive": {"korean": "엄마가 '뛰지 마세요.'라고 했어요.", "english": "Mom said 'Don't run.'"},
534
+ "negative": {"korean": "엄마가 뛰지 말라고 했어요.", "english": "Mom told us not to run."},
535
+ "focus_word": "말라고",
536
+ "rule_shown": "뛰다 + 지 말라고",
537
+ },
538
+ ],
539
+ "speaking_sentences": [
540
+ {"korean": "선생님이 조용히 하라고 했어요.", "english": "The teacher told us to be quiet.", "difficulty": 2},
541
+ {"korean": "친구가 같이 가라고 했어요.", "english": "My friend told me to go together.", "difficulty": 2},
542
+ {"korean": "엄마가 빨리 오라고 했어요.", "english": "Mom told me to come quickly.", "difficulty": 2},
543
+ ],
544
+ },
545
+
546
+ "indirect_quote_questions": {
547
+ "explanation": {
548
+ "title": "Indirect Quotation — Questions",
549
+ "body": (
550
+ "냐고 is used to report questions. "
551
+ "Attach to verb/adjective stems. "
552
+ "If the stem ends in ㄹ, drop ㄹ before adding 냐고. "
553
+ "물었어요 (asked) or 물어봤어요 typically follows."
554
+ ),
555
+ "pattern": "V/Adj-stem + 냐고 (drop ㄹ from ㄹ-irregular stems)",
556
+ "notes": "냐고 replaces the question ending 아요/어요/이에요.",
557
+ },
558
+ "example_sentences": [
559
+ {
560
+ "positive": {"korean": "지혜가 '지금 쉬어요?'라고 물었어요.", "english": "Jihye asked 'Are you resting now?'"},
561
+ "negative": {"korean": "지혜는 지금 쉬냐고 물었어요.", "english": "Jihye asked if I am resting now."},
562
+ "focus_word": "쉬냐고",
563
+ "rule_shown": "쉬다 → 쉬 + 냐고 (drop 다)",
564
+ },
565
+ {
566
+ "positive": {"korean": "친구가 '어디 가요?'라고 물었어요.", "english": "My friend asked 'Where are you going?'"},
567
+ "negative": {"korean": "친구가 어디 가냐고 물었어요.", "english": "My friend asked where I was going."},
568
+ "focus_word": "가냐고",
569
+ "rule_shown": "가다 → 가 + 냐고",
570
+ },
571
+ ],
572
+ "speaking_sentences": [
573
+ {"korean": "지혜는 지금 쉬냐고 물었어요.", "english": "Jihye asked if I am resting now.", "difficulty": 2},
574
+ {"korean": "선생님이 숙제를 했냐고 물었어요.", "english": "The teacher asked if I did the homework.", "difficulty": 3},
575
+ {"korean": "친구가 밥 먹었냐고 물었어요.", "english": "My friend asked if I ate.", "difficulty": 2},
576
+ ],
577
+ },
578
+
579
+ "indirect_quote_suggestions": {
580
+ "explanation": {
581
+ "title": "Indirect Quotation — Suggestions",
582
+ "body": (
583
+ "자고 is used to report suggestions (let's do something). "
584
+ "Attach directly to the verb stem. "
585
+ "했어요 or 해요 typically follows."
586
+ ),
587
+ "pattern": "V-stem + 자고 했어요/해요",
588
+ "notes": "자 is the plain form suggestion ending. 자고 = quoting that suggestion.",
589
+ },
590
+ "example_sentences": [
591
+ {
592
+ "positive": {"korean": "친구가 '같이 밥 먹자.'라고 했어요.", "english": "My friend said 'Let's eat together.'"},
593
+ "negative": {"korean": "친구가 같이 밥 먹자고 했어요.", "english": "My friend suggested eating together."},
594
+ "focus_word": "먹자고",
595
+ "rule_shown": "먹다 → 먹 + 자고",
596
+ },
597
+ {
598
+ "positive": {"korean": "예나가 '일찍 집에 가자.'라고 했어요.", "english": "Yena said 'Let's go home early.'"},
599
+ "negative": {"korean": "예나는 일찍 집에 가자고 했어요.", "english": "Yena suggested going home early."},
600
+ "focus_word": "가자고",
601
+ "rule_shown": "가다 → 가 + 자고",
602
+ },
603
+ ],
604
+ "speaking_sentences": [
605
+ {"korean": "친구가 같이 공부하자고 했어요.", "english": "My friend suggested studying together.", "difficulty": 2},
606
+ {"korean": "민수가 영화 보러 가자고 했어요.", "english": "Minsu suggested going to watch a movie.", "difficulty": 2},
607
+ {"korean": "선생님이 천천히 읽자고 했어요.", "english": "The teacher suggested reading slowly.", "difficulty": 3},
608
+ ],
609
+ },
610
+
611
+ "regret_expression": {
612
+ "explanation": {
613
+ "title": "Expressing Regret — (으)ㄹ 걸 그랬다",
614
+ "body": (
615
+ "(으)ㄹ 걸 그랬다 expresses regret about something you did or didn't do. "
616
+ "Use 을 걸 after consonant-ending stems, ㄹ 걸 after vowel-ending stems. "
617
+ "지 말 걸 그랬다 expresses regret about something you did (shouldn't have done)."
618
+ ),
619
+ "pattern": "V-stem + (으)ㄹ 걸 그랬다 | V + 지 말 걸 그랬다",
620
+ "notes": "그랬다 can be softened to 그랬어 in casual speech.",
621
+ },
622
+ "example_sentences": [
623
+ {
624
+ "positive": {"korean": "수업에 갔어요.", "english": "I went to class."},
625
+ "negative": {"korean": "수업에 갈 걸 그랬어요.", "english": "I should have gone to class."},
626
+ "focus_word": "갈 걸 그랬어요",
627
+ "rule_shown": "가다 → 가 + ㄹ 걸 그랬어요",
628
+ },
629
+ {
630
+ "positive": {"korean": "그 음식을 먹었어요.", "english": "I ate that food."},
631
+ "negative": {"korean": "그 음식을 먹지 말 걸 그랬어요.", "english": "I shouldn't have eaten that food."},
632
+ "focus_word": "먹지 말 걸 그랬어요",
633
+ "rule_shown": "먹다 + 지 말 걸 그랬어요",
634
+ },
635
+ ],
636
+ "speaking_sentences": [
637
+ {"korean": "더 열심히 공부할 걸 그랬어요.", "english": "I should have studied harder.", "difficulty": 2},
638
+ {"korean": "일찍 잘 걸 그랬어요.", "english": "I should have slept early.", "difficulty": 2},
639
+ {"korean": "그 말을 하지 말 걸 그랬어요.", "english": "I shouldn't have said that.", "difficulty": 3},
640
+ ],
641
+ },
642
+ }
643
+
644
+
645
+ def get_lesson_content(grammar_rule: str) -> dict:
646
+ """Return full lesson content for a grammar rule (all 6 frames)."""
647
+ return LESSON_CONTENT.get(grammar_rule, {})
648
+
649
+
650
+ def get_explanation(grammar_rule: str) -> dict:
651
+ """Return Frame 1+2 data: title, body, pattern, notes."""
652
+ content = LESSON_CONTENT.get(grammar_rule, {})
653
+ rule = GRAMMAR_RULES.get(grammar_rule, {})
654
+ expl = content.get("explanation", {})
655
+ return {
656
+ "grammar_rule": grammar_rule,
657
+ "title": expl.get("title", rule.get("name", grammar_rule)),
658
+ "body": expl.get("body", rule.get("description", "")),
659
+ "pattern": expl.get("pattern", ""),
660
+ "notes": expl.get("notes", ""),
661
+ "difficulty": rule.get("difficulty", 1),
662
+ "lesson": rule.get("lesson", ""),
663
+ }
664
+
665
+
666
+ def get_example_sentences(grammar_rule: str) -> list:
667
+ """Return Frame 3 data: positive/negative sentence pairs with focus word."""
668
+ content = LESSON_CONTENT.get(grammar_rule, {})
669
+ return content.get("example_sentences", [])
670
+
671
+
672
+ def get_speaking_sentences(grammar_rule: str, difficulty: int = None) -> list:
673
+ """Return Frame 5 data: sentences for speaking practice, optionally filtered by difficulty."""
674
+ content = LESSON_CONTENT.get(grammar_rule, {})
675
+ sentences = content.get("speaking_sentences", [])
676
+ if difficulty is not None:
677
+ sentences = [s for s in sentences if s.get("difficulty", 1) <= difficulty]
678
+ return sentences