From 8e8e0184452803cebbc7908d7fec6f50a365567a Mon Sep 17 00:00:00 2001 From: polv Date: Sat, 31 Oct 2026 12:44:24 +0700 Subject: [PATCH] fix context sentences in YAML to ensure vocab emphasis --- .../.vitepress/theme/components/VocabQuiz.vue | 4 +- docs/.vitepress/theme/types.ts | 51 ++++++++++++++----- .../theme/02-transportation.md | 6 +-- docs/howtostudykorean/theme/03-eating.md | 4 +- docs/howtostudykorean/theme/04-shopping.md | 8 +-- docs/howtostudykorean/unit-1/01-sentences.md | 6 +-- docs/howtostudykorean/unit-1/02-particles.md | 2 +- docs/howtostudykorean/unit-1/03-verbs.md | 8 +-- docs/howtostudykorean/unit-1/04-adjectives.md | 2 +- docs/howtostudykorean/unit-1/05-tenses.md | 2 +- docs/howtostudykorean/unit-1/06-honorifics.md | 4 +- docs/howtostudykorean/unit-1/08-adverbs.md | 4 +- docs/howtostudykorean/unit-1/11-time.md | 6 +-- .../unit-1/12-more-particles.md | 6 +-- .../unit-1/15-good-carry-similar.md | 4 +- .../howtostudykorean/unit-1/16-relating-to.md | 2 +- .../unit-1/19-comparatives.md | 4 +- .../howtostudykorean/unit-1/20-well-poorly.md | 8 +-- .../unit-1/25-anybody-everybody.md | 4 +- 19 files changed, 79 insertions(+), 56 deletions(-) diff --git a/docs/.vitepress/theme/components/VocabQuiz.vue b/docs/.vitepress/theme/components/VocabQuiz.vue index 76cae4f..f73347b 100644 --- a/docs/.vitepress/theme/components/VocabQuiz.vue +++ b/docs/.vitepress/theme/components/VocabQuiz.vue @@ -146,7 +146,7 @@ import { import yaml from "yaml"; import SentenceAudio from "./SentenceAudio.vue"; import { supabase } from "../supabase.ts"; -import { IVoc, Voc } from "../types.ts"; +import { fmValueParser, IVoc, Voc } from "../types.ts"; import { LLMstream } from "../llm.ts"; import MarkdownIt from "markdown-it"; @@ -263,7 +263,7 @@ watch(sent_ko, () => { const vocabulary: Record = {}; for (const [k, vs] of Object.entries( - frontmatter.value[fmKey] as Record, + fmValueParser.parse(frontmatter.value[fmKey]), )) { vocabulary[k] = [...(vocabulary[k] || []), ...vs]; diff --git a/docs/.vitepress/theme/types.ts b/docs/.vitepress/theme/types.ts index f4afd96..b3ca119 100644 --- a/docs/.vitepress/theme/types.ts +++ b/docs/.vitepress/theme/types.ts @@ -1,17 +1,40 @@ import * as z from "zod"; -export const Voc = z.object({ - ko: z.string(), - ko_text: z.string().optional(), - audio: z.string().optional(), - en: z.string(), - get usage() { - return z.array(Voc).optional(); - }, - notes: z.union([z.string(), z.array(z.string())]).optional(), - get examples() { - return z.array(Voc).optional(); - }, -}); +// 1. Define the interface manually (do not use z.infer here) +export interface IVoc { + ko: string; + ko_text?: string; + audio?: string; + en: string; + usage?: IVoc[]; + notes?: string | string[]; + examples?: IVoc[]; +} -export type IVoc = z.infer; +// 2. Annotate the schema with the manually defined interface +export const Voc: z.ZodType = z.lazy(() => + z.object({ + ko: z.string(), + ko_text: z.string().optional(), + audio: z.string().optional(), + en: z.string(), + usage: z.array(Voc).optional(), + notes: z.union([z.string(), z.array(z.string())]).optional(), + examples: z + .array(Voc) + .superRefine((val, ctx) => { + for (const x of val) { + if (!isEmp(x.ko)) { + ctx.addIssue(`${JSON.stringify(x)} must contain **emp** text`); + } + } + }) + .optional(), + }), +); + +export const fmValueParser = z.record(z.string(), z.array(Voc)); + +function isEmp(s: string) { + return /\*\*.+\*\*/.test(s); +} diff --git a/docs/howtostudykorean/theme/02-transportation.md b/docs/howtostudykorean/theme/02-transportation.md index d978b14..0c2828b 100644 --- a/docs/howtostudykorean/theme/02-transportation.md +++ b/docs/howtostudykorean/theme/02-transportation.md @@ -117,7 +117,7 @@ vocabulary: [길 tends to emphasize the route/path itself — a road to walk or drive on — while 거리 tends to emphasize the street as a place/area.] examples: - ko: 저는 **길**을 잃었어요 - en: I'm lost + en: I'm **lost** - ko: 우리는 **길**을 건너야 돼요 en: We have to cross the **street** - ko: 이 **길**에서 직진하셔요 @@ -148,9 +148,9 @@ vocabulary: examples: - ko: "**교통카드**를 어디서 살 수 있어요?" en: Where can you buy a **transportation card**? - - ko: 교통 카드를 어디서 충전할 수 있어요? + - ko: "**교통 카드**를 어디서 충전할 수 있어요?" en: Where can I charge my **transportation card**? - - ko: 교통 카드를 잃어버렸어요 + - ko: "**교통 카드**를 잃어버렸어요" en: I lost my **transportation card**? - ko: 자리 diff --git a/docs/howtostudykorean/theme/03-eating.md b/docs/howtostudykorean/theme/03-eating.md index d9ae80f..e2a44be 100644 --- a/docs/howtostudykorean/theme/03-eating.md +++ b/docs/howtostudykorean/theme/03-eating.md @@ -866,9 +866,9 @@ vocabulary: - ko: 김밥 en: A roll of rice and other ingredients wrapped in seaweed examples: - - ko: 김밥 1줄 주세요 + - ko: "**김밥** 1줄 주세요" en: One (line) of **kimbab** please - - ko: 김밥은 얼마예요? + - ko: "**김밥**은 얼마예요?" en: How much is (the) **kimbab**? - ko: 떡 diff --git a/docs/howtostudykorean/theme/04-shopping.md b/docs/howtostudykorean/theme/04-shopping.md index f294325..39c867c 100644 --- a/docs/howtostudykorean/theme/04-shopping.md +++ b/docs/howtostudykorean/theme/04-shopping.md @@ -425,10 +425,10 @@ vocabulary: notes: | The examples below use the related noun form 환불 (refund) with 되다/받다, which is very common in everyday speech alongside the plain verb 환불하다. examples: - - ko: "환불은 안 됩니다" - en: "No refund" - - ko: "사과가 다 상해서 환불을 받아야 돼요" - en: "I need to get a refund because all the apples have gone bad" + - ko: "**환불**은 안 됩니다" + en: "No **refund**" + - ko: "사과가 다 상해서 **환불**을 받아야 돼요" + en: "I need to get a **refund** because all the apples have gone bad" - ko: "비교하다" en: "to compare" diff --git a/docs/howtostudykorean/unit-1/01-sentences.md b/docs/howtostudykorean/unit-1/01-sentences.md index 1c30128..b9c2857 100644 --- a/docs/howtostudykorean/unit-1/01-sentences.md +++ b/docs/howtostudykorean/unit-1/01-sentences.md @@ -103,11 +103,11 @@ vocabulary: en: That **man** came into room - ko: 저는 잘생긴 **남자**를 만났어요 en: I met a handsome **man** - - ko: 저의 친구는 주로 남자예요 + - ko: 저의 친구는 주로 **남자**예요 en: My friends are mostly **men** - - ko: 그 남자가 키가 너무 커요 + - ko: 그 **남자**가 키가 너무 커요 en: That **man** is very tall - - ko: 어떤 남자는 어제 여기에 왔어 + - ko: 어떤 **남자**는 어제 여기에 왔어 en: Some **man** came here yesterday - ko: 여자 diff --git a/docs/howtostudykorean/unit-1/02-particles.md b/docs/howtostudykorean/unit-1/02-particles.md index e56fad3..4bc35b9 100644 --- a/docs/howtostudykorean/unit-1/02-particles.md +++ b/docs/howtostudykorean/unit-1/02-particles.md @@ -116,7 +116,7 @@ vocabulary: en: Who is the owner of that **dog**? - ko: 고양이는 **강아지**와 달라요 en: Cats are different than **dogs** - - ko: 그 강아지의 꼬리는 아주 귀여워요 + - ko: 그 **강아지**의 꼬리는 아주 귀여워요 en: That **puppy's** tail is very cute - ko: 경찰관은 **강아지**의 주인에게 십만 원의 벌금을 물렸어요 en: The police officers gave the owner of the **dog** a 100 000 won fine diff --git a/docs/howtostudykorean/unit-1/03-verbs.md b/docs/howtostudykorean/unit-1/03-verbs.md index ee07c07..357ba88 100644 --- a/docs/howtostudykorean/unit-1/03-verbs.md +++ b/docs/howtostudykorean/unit-1/03-verbs.md @@ -409,7 +409,7 @@ vocabulary: en: I **want** that book - ko: "어떤 종류의 차를 **원해요**?" en: What type of car do you **want**? - - ko: 저의 여자 친구는 제가 사과를 가져오는 것을 원해요 + - ko: 저의 여자 친구는 제가 사과를 가져오는 것을 **원해요** en: My girlfriend **wants** me to bring apples - ko: 만들다 @@ -511,7 +511,7 @@ vocabulary: en: I **like** our school - ko: 저는 그 선생님을 **좋아해요** en: I **like** that teacher - - ko: 저는 수학을 제일 좋아해요 + - ko: 저는 수학을 제일 **좋아해요** en: I **like** math most (math is my favorite) - ko: 아이들은 만화영화를 매우 **좋아해요** en: Children really **like** animated movies @@ -550,7 +550,7 @@ vocabulary: examples: - ko: 저는 **작은** 집에서 살아요 en: I live in a **small** house - - ko: 이것은 너무 작은가요? + - ko: 이것은 너무 **작은**가요? en: Is this too **small**? - ko: 당근을 **작은** 조각으로 자르세요 en: Cut the carrots into **small** pieces, please @@ -722,7 +722,7 @@ vocabulary: en: I eat too much sometimes - ko: 저는 어제 **너무** 아팠어요 en: I was really sick yesterday - - ko: 한식은 너무 맛있어요 + - ko: 한식은 **너무** 맛있어요 en: Korean food is **very** delicious - ko: 그 남자가 키가 **너무** 커요 en: That man is **very** tall diff --git a/docs/howtostudykorean/unit-1/04-adjectives.md b/docs/howtostudykorean/unit-1/04-adjectives.md index 71d1884..153fea6 100644 --- a/docs/howtostudykorean/unit-1/04-adjectives.md +++ b/docs/howtostudykorean/unit-1/04-adjectives.md @@ -462,7 +462,7 @@ vocabulary: en: We **walked** home - ko: 저는 10분 동안 **걸었어요** en: I **walked** for 10 minutes - - ko: 여자는 학교에 걸었어요 + - ko: 여자는 학교에 **걸었어요** en: The girl **walked** to school - ko: 그 여자는 항상 그렇게 **걸어요** en: That girl always **walks** like that diff --git a/docs/howtostudykorean/unit-1/05-tenses.md b/docs/howtostudykorean/unit-1/05-tenses.md index df85fb9..7161eaa 100644 --- a/docs/howtostudykorean/unit-1/05-tenses.md +++ b/docs/howtostudykorean/unit-1/05-tenses.md @@ -436,7 +436,7 @@ vocabulary: examples: - ko: 우리 집은 너무 **멀어요** en: Our home is very **far** - - ko: 저는 먼 병원에 갔어요 + - ko: 저는 **먼** 병원에 갔어요 en: I went to a **far away** hospital (a hospital that is **far away**) - ko: 마르다 diff --git a/docs/howtostudykorean/unit-1/06-honorifics.md b/docs/howtostudykorean/unit-1/06-honorifics.md index 17c2b0e..e8d2875 100644 --- a/docs/howtostudykorean/unit-1/06-honorifics.md +++ b/docs/howtostudykorean/unit-1/06-honorifics.md @@ -59,7 +59,7 @@ vocabulary: examples: - ko: 저의 여자 친구는 저보다 **나이**가 더 많아요 en: My girlfriend is **older** than me - - ko: 나이가 많은 사람들은 항상 재채기를 시끄럽게 해요 + - ko: "**나이**가 많은 사람들은 항상 재채기를 시끄럽게 해요" en: "**Old** people always sneeze loudly" - ko: 그 사람이 **나이**가 많지만 여전히 똑똑해요 en: Although that person is **old**, he is still very smart @@ -258,7 +258,7 @@ vocabulary: examples: - ko: 전화번호를 **종이**에 써 주세요 en: Write your phone number on a piece of **paper** please - - ko: 저는 그 수학 문제를 연필과 종이로 풀었어요 + - ko: 저는 그 수학 문제를 연필과 **종이**로 풀었어요 en: I solved that math problem using a **paper** and a pencil - ko: 그 **종이**를 공책에 풀로 붙이세요! en: Stick that **paper** to your notebook using glue! diff --git a/docs/howtostudykorean/unit-1/08-adverbs.md b/docs/howtostudykorean/unit-1/08-adverbs.md index 0b186ce..d290f26 100644 --- a/docs/howtostudykorean/unit-1/08-adverbs.md +++ b/docs/howtostudykorean/unit-1/08-adverbs.md @@ -29,7 +29,7 @@ vocabulary: en: If you want to go to **university**, you have to study hard - ko: 아들이 **대학교**를 졸업해서 우리는 축하를 해야 돼요 en: Now that our son has graduated from **University**, we need to congratulate him - - ko: 원래 대학교에 갈 계획이 있었지만 수능을 잘 못 봐서 대학교에 갈 수 없었어요 + - ko: 원래 **대학교**에 갈 계획이 있었지만 수능을 잘 못 봐서 대학교에 갈 수 없었어요 en: I had plans to go to **university**, but I couldn't get in because I did poorly on the SAT test - ko: 트럭 @@ -361,7 +361,7 @@ vocabulary: en: I will **pay** this time - ko: 아빠가 돈을 이미 **낸** 것 같아요 en: It seems like dad already **paid** - - ko: 우리가 청구서를 늦게라도 낼 거예요 + - ko: 우리가 청구서를 늦게라도 **낼** 거예요 en: We are going to **pay** the bill, even if it is a little late - ko: 받다 diff --git a/docs/howtostudykorean/unit-1/11-time.md b/docs/howtostudykorean/unit-1/11-time.md index 3d25c5c..b5944a9 100644 --- a/docs/howtostudykorean/unit-1/11-time.md +++ b/docs/howtostudykorean/unit-1/11-time.md @@ -513,11 +513,11 @@ vocabulary: en: I will go to the US **next week** - ko: 저는 **다음** **주**에 시험 공부를 할 거예요 en: "**Next week**, I will study for an exam" - - ko: 다음 주 목요일은 휴가인가? + - ko: "**다음** 주 목요일은 휴가인가?" en: Is **next Thursday** a holiday? - - ko: 아직 간 적이 없어요. 하지만 다음 주에 가 볼 거예요 + - ko: 아직 간 적이 없어요. 하지만 **다음** 주에 가 볼 거예요 en: I haven't been there yet. But, I am going (to try) to go **next week** - - ko: 우리는 다음 주에 그 문제에 대한 회의를 열 거예요 + - ko: 우리는 **다음** 주에 그 문제에 대한 회의를 열 거예요 en: We are going to hold a meeting **next week** about that problem - ko: 다음 달 diff --git a/docs/howtostudykorean/unit-1/12-more-particles.md b/docs/howtostudykorean/unit-1/12-more-particles.md index f9e2b97..4965d55 100644 --- a/docs/howtostudykorean/unit-1/12-more-particles.md +++ b/docs/howtostudykorean/unit-1/12-more-particles.md @@ -283,7 +283,7 @@ vocabulary: en: All the teachers **left** (went out) - ko: 문을 열어서 밖으로 **나갔어요** en: I opened the door and then **went outside** - - ko: 그는 방금 나갔어요 + - ko: 그는 방금 **나갔어요** en: He just **left** - ko: 쓰다 @@ -521,9 +521,9 @@ vocabulary: 몇 can also be used to mean "some." For example: - "저는 사과 몇 개를 샀어요" = "I bought some apples" (see Lesson 12 for more information) examples: - - ko: 저는 친구 몇 명을 만났어요 + - ko: 저는 친구 **몇** 명을 만났어요 en: I met **some** friends - - ko: 친구가 몇 명 있어요? + - ko: 친구가 **몇** 명 있어요? en: "**How many** friends do you have?" - ko: 층 diff --git a/docs/howtostudykorean/unit-1/15-good-carry-similar.md b/docs/howtostudykorean/unit-1/15-good-carry-similar.md index 4dcd172..68dd539 100644 --- a/docs/howtostudykorean/unit-1/15-good-carry-similar.md +++ b/docs/howtostudykorean/unit-1/15-good-carry-similar.md @@ -296,9 +296,9 @@ vocabulary: en: The **picture** is hanging on the wall - ko: 저는 그 **그림**이 마음에 들어요 en: I like that **picture** - - ko: "**그** 그림은 높은 가치가 있어요" + - ko: "그 **그림**은 높은 가치가 있어요" en: That **picture** has a high value - - ko: 그 학생은 그림을 잘 그리는 재능을 가지고 있어요 + - ko: 그 학생은 **그림**을 잘 그리는 재능을 가지고 있어요 en: That student has a talent for **drawing** (**pictures**) - ko: 그 **그림**을 볼 때 배경이 무슨 의미가 있는지 생각해 보세요 en: When you look at the **painting,** try to think about what meaning the background has diff --git a/docs/howtostudykorean/unit-1/16-relating-to.md b/docs/howtostudykorean/unit-1/16-relating-to.md index 67e965b..4c4f4ba 100644 --- a/docs/howtostudykorean/unit-1/16-relating-to.md +++ b/docs/howtostudykorean/unit-1/16-relating-to.md @@ -448,7 +448,7 @@ vocabulary: examples: - ko: 저는 숙제를 **나중에** 할 거예요 en: I am going to do my homework **later** - - ko: "나중에** 밥이 없을 거라서 저는 지금 먹고 싶어요" + - ko: "**나중에** 밥이 없을 거라서 저는 지금 먹고 싶어요" en: There will not be any food **later**, therefore, I want to eat now - ko: 선생님! 이 문제를 파악할 수 없어요. **나중**에 선생님의 교무실에 가도 돼요? en: Teacher! I can't grasp/understand this problem. May I go to your office **later**? diff --git a/docs/howtostudykorean/unit-1/19-comparatives.md b/docs/howtostudykorean/unit-1/19-comparatives.md index a876439..0c73080 100644 --- a/docs/howtostudykorean/unit-1/19-comparatives.md +++ b/docs/howtostudykorean/unit-1/19-comparatives.md @@ -340,9 +340,9 @@ vocabulary: audio: https://www.howtostudykorean.com/wp-content/uploads/2015/11/Lesson19v29.mp3 en: less examples: - - ko: 나는 남동생보다 덜 잘생겼어 + - ko: 나는 남동생보다 **덜** 잘생겼어 audio: https://www.howtostudykorean.com/wp-content/uploads/2017/03/Lesson19-30.mp3 - en: I'm less handsome than my brother + en: I'm **less** handsome than my brother - ko: 한국에서 대학교는 고등학교보다 **덜** 어려워요 audio: https://www.howtostudykorean.com/wp-content/uploads/2017/03/Lesson19-31.mp3 en: In Korea, University is **not as hard** as high school diff --git a/docs/howtostudykorean/unit-1/20-well-poorly.md b/docs/howtostudykorean/unit-1/20-well-poorly.md index b58ba1b..580b39f 100644 --- a/docs/howtostudykorean/unit-1/20-well-poorly.md +++ b/docs/howtostudykorean/unit-1/20-well-poorly.md @@ -188,9 +188,9 @@ vocabulary: 못하다 has the opposite meaning of 잘하다. For example: - "나는 수영을 못해" = "I am bad at swimming" examples: - - ko: 나는 수영을 못해 + - ko: 나는 수영을 **못해** en: I am **bad at** swimming - - ko: 저 학생은 공부를 못해 + - ko: 저 학생은 공부를 **못해** audio: https://www.howtostudykorean.com/wp-content/uploads/2017/03/Lesson20-10.mp3 en: That student does **not** study **well** - ko: 제가 너무 부끄러워서 발표를 **못해요** @@ -406,9 +406,9 @@ vocabulary: The usage of 못 is very complex. See below in this lesson for more information. examples: - - ko: 저는 어제 시험을 못 봤어요 + - ko: 저는 어제 시험을 **못** 봤어요 audio: https://www.howtostudykorean.com/wp-content/uploads/2017/03/Lesson20-12.mp3 - en: I did **poorly** on the exam yesterday / I didn't write the exam yesterday + en: I did **poorly** on the exam yesterday / I **didn't** write the exam yesterday - ko: 이 셔츠가 너무 작아서 **못** 입어요 en: I **can't** put this shirt on because it is too small - ko: 저는 그 동안 공부를 **못** 했어요 diff --git a/docs/howtostudykorean/unit-1/25-anybody-everybody.md b/docs/howtostudykorean/unit-1/25-anybody-everybody.md index 0218ee7..1308393 100644 --- a/docs/howtostudykorean/unit-1/25-anybody-everybody.md +++ b/docs/howtostudykorean/unit-1/25-anybody-everybody.md @@ -185,7 +185,7 @@ vocabulary: en: I didn't see anybody/I saw **nobody** - ko: 저는 **아무도** 만나고 싶지 않아요 en: I don't want to meet anybody/I want to meet **nobody** - - ko: 아무도 집에 가지 않았어요 + - ko: "**아무도** 집에 가지 않았어요" en: "**Nobody** went home" - ko: 저는 그 말을 **아무에게도** 안 했어요 en: I didn't say that to anybody/I said that to **nobody** @@ -277,7 +277,7 @@ vocabulary: examples: - ko: 돈이 없어서 갈 수 있는 **데**가 없었어요 en: He had **nowhere** to go because he had no money - - ko: 우리가 처음에 만난 데에 갔어요 + - ko: 우리가 처음에 만난 **데**에 갔어요 en: We went to the **place** that we met for the first time - ko: 그녀가 사는 **데**는 조금 멀어요 en: She lives a little bit far (The **place** that she lives is a little far)