fix context sentences in YAML to ensure vocab emphasis

This commit is contained in:
polv committed 2026-10-31 12:44:24 +07:00
1 parent 363a728fc3
commit 8e8e018445
19 files changed
+74 -51

No files matched your search

@@ -146,7 +146,7 @@ import {
import yaml from "yaml"; import yaml from "yaml";
import SentenceAudio from "./SentenceAudio.vue"; import SentenceAudio from "./SentenceAudio.vue";
import { supabase } from "../supabase.ts"; import { supabase } from "../supabase.ts";
import { IVoc, Voc } from "../types.ts"; import { fmValueParser, IVoc, Voc } from "../types.ts";
import { LLMstream } from "../llm.ts"; import { LLMstream } from "../llm.ts";
import MarkdownIt from "markdown-it"; import MarkdownIt from "markdown-it";
@@ -263,7 +263,7 @@ watch(sent_ko, () => {
const vocabulary: Record<string, IVoc[]> = {}; const vocabulary: Record<string, IVoc[]> = {};
for (const [k, vs] of Object.entries( for (const [k, vs] of Object.entries(
frontmatter.value[fmKey] as Record<string, IVoc[]>, fmValueParser.parse(frontmatter.value[fmKey]),
)) { )) {
vocabulary[k] = [...(vocabulary[k] || []), ...vs]; vocabulary[k] = [...(vocabulary[k] || []), ...vs];
+32 -9
View File
@@ -1,17 +1,40 @@
import * as z from "zod"; import * as z from "zod";
export const Voc = z.object({ // 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[];
}
// 2. Annotate the schema with the manually defined interface
export const Voc: z.ZodType<IVoc> = z.lazy(() =>
z.object({
ko: z.string(), ko: z.string(),
ko_text: z.string().optional(), ko_text: z.string().optional(),
audio: z.string().optional(), audio: z.string().optional(),
en: z.string(), en: z.string(),
get usage() { usage: z.array(Voc).optional(),
return z.array(Voc).optional();
},
notes: z.union([z.string(), z.array(z.string())]).optional(), notes: z.union([z.string(), z.array(z.string())]).optional(),
get examples() { examples: z
return z.array(Voc).optional(); .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 type IVoc = z.infer<typeof Voc>; export const fmValueParser = z.record(z.string(), z.array(Voc));
function isEmp(s: string) {
return /\*\*.+\*\*/.test(s);
}
@@ -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.] [길 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: examples:
- ko: 저는 **길**을 잃었어요 - ko: 저는 **길**을 잃었어요
en: I'm lost en: I'm **lost**
- ko: 우리는 **길**을 건너야 돼요 - ko: 우리는 **길**을 건너야 돼요
en: We have to cross the **street** en: We have to cross the **street**
- ko: 이 **길**에서 직진하셔요 - ko: 이 **길**에서 직진하셔요
@@ -148,9 +148,9 @@ vocabulary:
examples: examples:
- ko: "**교통카드**를 어디서 살 수 있어요?" - ko: "**교통카드**를 어디서 살 수 있어요?"
en: Where can you buy a **transportation card**? en: Where can you buy a **transportation card**?
- ko: 교통 카드를 어디서 충전할 수 있어요? - ko: "**교통 카드**를 어디서 충전할 수 있어요?"
en: Where can I charge my **transportation card**? en: Where can I charge my **transportation card**?
- ko: 교통 카드를 잃어버렸어요 - ko: "**교통 카드**를 잃어버렸어요"
en: I lost my **transportation card**? en: I lost my **transportation card**?
- ko: 자리 - ko: 자리
+2 -2
View File
@@ -866,9 +866,9 @@ vocabulary:
- ko: 김밥 - ko: 김밥
en: A roll of rice and other ingredients wrapped in seaweed en: A roll of rice and other ingredients wrapped in seaweed
examples: examples:
- ko: 김밥 1줄 주세요 - ko: "**김밥** 1줄 주세요"
en: One (line) of **kimbab** please en: One (line) of **kimbab** please
- ko: 김밥은 얼마예요? - ko: "**김밥**은 얼마예요?"
en: How much is (the) **kimbab**? en: How much is (the) **kimbab**?
- ko: 떡 - ko: 떡
+4 -4
View File
@@ -425,10 +425,10 @@ vocabulary:
notes: | notes: |
The examples below use the related noun form 환불 (refund) with 되다/받다, which is very common in everyday speech alongside the plain verb 환불하다. The examples below use the related noun form 환불 (refund) with 되다/받다, which is very common in everyday speech alongside the plain verb 환불하다.
examples: examples:
- ko: "환불은 안 됩니다" - ko: "**환불**은 안 됩니다"
en: "No refund" en: "No **refund**"
- ko: "사과가 다 상해서 환불을 받아야 돼요" - ko: "사과가 다 상해서 **환불**을 받아야 돼요"
en: "I need to get a refund because all the apples have gone bad" en: "I need to get a **refund** because all the apples have gone bad"
- ko: "비교하다" - ko: "비교하다"
en: "to compare" en: "to compare"
+3 -3
View File
@@ -103,11 +103,11 @@ vocabulary:
en: That **man** came into room en: That **man** came into room
- ko: 저는 잘생긴 **남자**를 만났어요 - ko: 저는 잘생긴 **남자**를 만났어요
en: I met a handsome **man** en: I met a handsome **man**
- ko: 저의 친구는 주로 남자예요 - ko: 저의 친구는 주로 **남자**예요
en: My friends are mostly **men** en: My friends are mostly **men**
- ko: 그 남자가 키가 너무 커요 - ko: 그 **남자**가 키가 너무 커요
en: That **man** is very tall en: That **man** is very tall
- ko: 어떤 남자는 어제 여기에 왔어 - ko: 어떤 **남자**는 어제 여기에 왔어
en: Some **man** came here yesterday en: Some **man** came here yesterday
- ko: 여자 - ko: 여자
+1 -1
View File
@@ -116,7 +116,7 @@ vocabulary:
en: Who is the owner of that **dog**? en: Who is the owner of that **dog**?
- ko: 고양이는 **강아지**와 달라요 - ko: 고양이는 **강아지**와 달라요
en: Cats are different than **dogs** en: Cats are different than **dogs**
- ko: 그 강아지의 꼬리는 아주 귀여워요 - ko: 그 **강아지**의 꼬리는 아주 귀여워요
en: That **puppy's** tail is very cute en: That **puppy's** tail is very cute
- ko: 경찰관은 **강아지**의 주인에게 십만 원의 벌금을 물렸어요 - ko: 경찰관은 **강아지**의 주인에게 십만 원의 벌금을 물렸어요
en: The police officers gave the owner of the **dog** a 100 000 won fine en: The police officers gave the owner of the **dog** a 100 000 won fine
+4 -4
View File
@@ -409,7 +409,7 @@ vocabulary:
en: I **want** that book en: I **want** that book
- ko: "어떤 종류의 차를 **원해요**?" - ko: "어떤 종류의 차를 **원해요**?"
en: What type of car do you **want**? en: What type of car do you **want**?
- ko: 저의 여자 친구는 제가 사과를 가져오는 것을 원해요 - ko: 저의 여자 친구는 제가 사과를 가져오는 것을 **원해요**
en: My girlfriend **wants** me to bring apples en: My girlfriend **wants** me to bring apples
- ko: 만들다 - ko: 만들다
@@ -511,7 +511,7 @@ vocabulary:
en: I **like** our school en: I **like** our school
- ko: 저는 그 선생님을 **좋아해요** - ko: 저는 그 선생님을 **좋아해요**
en: I **like** that teacher en: I **like** that teacher
- ko: 저는 수학을 제일 좋아해요 - ko: 저는 수학을 제일 **좋아해요**
en: I **like** math most (math is my favorite) en: I **like** math most (math is my favorite)
- ko: 아이들은 만화영화를 매우 **좋아해요** - ko: 아이들은 만화영화를 매우 **좋아해요**
en: Children really **like** animated movies en: Children really **like** animated movies
@@ -550,7 +550,7 @@ vocabulary:
examples: examples:
- ko: 저는 **작은** 집에서 살아요 - ko: 저는 **작은** 집에서 살아요
en: I live in a **small** house en: I live in a **small** house
- ko: 이것은 너무 작은가요? - ko: 이것은 너무 **작은**가요?
en: Is this too **small**? en: Is this too **small**?
- ko: 당근을 **작은** 조각으로 자르세요 - ko: 당근을 **작은** 조각으로 자르세요
en: Cut the carrots into **small** pieces, please en: Cut the carrots into **small** pieces, please
@@ -722,7 +722,7 @@ vocabulary:
en: I eat too much sometimes en: I eat too much sometimes
- ko: 저는 어제 **너무** 아팠어요 - ko: 저는 어제 **너무** 아팠어요
en: I was really sick yesterday en: I was really sick yesterday
- ko: 한식은 너무 맛있어요 - ko: 한식은 **너무** 맛있어요
en: Korean food is **very** delicious en: Korean food is **very** delicious
- ko: 그 남자가 키가 **너무** 커요 - ko: 그 남자가 키가 **너무** 커요
en: That man is **very** tall en: That man is **very** tall
@@ -462,7 +462,7 @@ vocabulary:
en: We **walked** home en: We **walked** home
- ko: 저는 10분 동안 **걸었어요** - ko: 저는 10분 동안 **걸었어요**
en: I **walked** for 10 minutes en: I **walked** for 10 minutes
- ko: 여자는 학교에 걸었어요 - ko: 여자는 학교에 **걸었어요**
en: The girl **walked** to school en: The girl **walked** to school
- ko: 그 여자는 항상 그렇게 **걸어요** - ko: 그 여자는 항상 그렇게 **걸어요**
en: That girl always **walks** like that en: That girl always **walks** like that
+1 -1
View File
@@ -436,7 +436,7 @@ vocabulary:
examples: examples:
- ko: 우리 집은 너무 **멀어요** - ko: 우리 집은 너무 **멀어요**
en: Our home is very **far** en: Our home is very **far**
- ko: 저는 먼 병원에 갔어요 - ko: 저는 **먼** 병원에 갔어요
en: I went to a **far away** hospital (a hospital that is **far away**) en: I went to a **far away** hospital (a hospital that is **far away**)
- ko: 마르다 - ko: 마르다
@@ -59,7 +59,7 @@ vocabulary:
examples: examples:
- ko: 저의 여자 친구는 저보다 **나이**가 더 많아요 - ko: 저의 여자 친구는 저보다 **나이**가 더 많아요
en: My girlfriend is **older** than me en: My girlfriend is **older** than me
- ko: 나이가 많은 사람들은 항상 재채기를 시끄럽게 해요 - ko: "**나이**가 많은 사람들은 항상 재채기를 시끄럽게 해요"
en: "**Old** people always sneeze loudly" en: "**Old** people always sneeze loudly"
- ko: 그 사람이 **나이**가 많지만 여전히 똑똑해요 - ko: 그 사람이 **나이**가 많지만 여전히 똑똑해요
en: Although that person is **old**, he is still very smart en: Although that person is **old**, he is still very smart
@@ -258,7 +258,7 @@ vocabulary:
examples: examples:
- ko: 전화번호를 **종이**에 써 주세요 - ko: 전화번호를 **종이**에 써 주세요
en: Write your phone number on a piece of **paper** please 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 en: I solved that math problem using a **paper** and a pencil
- ko: 그 **종이**를 공책에 풀로 붙이세요! - ko: 그 **종이**를 공책에 풀로 붙이세요!
en: Stick that **paper** to your notebook using glue! en: Stick that **paper** to your notebook using glue!
+2 -2
View File
@@ -29,7 +29,7 @@ vocabulary:
en: If you want to go to **university**, you have to study hard en: If you want to go to **university**, you have to study hard
- ko: 아들이 **대학교**를 졸업해서 우리는 축하를 해야 돼요 - ko: 아들이 **대학교**를 졸업해서 우리는 축하를 해야 돼요
en: Now that our son has graduated from **University**, we need to congratulate him 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 en: I had plans to go to **university**, but I couldn't get in because I did poorly on the SAT test
- ko: 트럭 - ko: 트럭
@@ -361,7 +361,7 @@ vocabulary:
en: I will **pay** this time en: I will **pay** this time
- ko: 아빠가 돈을 이미 **낸** 것 같아요 - ko: 아빠가 돈을 이미 **낸** 것 같아요
en: It seems like dad already **paid** en: It seems like dad already **paid**
- ko: 우리가 청구서를 늦게라도 낼 거예요 - ko: 우리가 청구서를 늦게라도 **낼** 거예요
en: We are going to **pay** the bill, even if it is a little late en: We are going to **pay** the bill, even if it is a little late
- ko: 받다 - ko: 받다
+3 -3
View File
@@ -513,11 +513,11 @@ vocabulary:
en: I will go to the US **next week** en: I will go to the US **next week**
- ko: 저는 **다음** **주**에 시험 공부를 할 거예요 - ko: 저는 **다음** **주**에 시험 공부를 할 거예요
en: "**Next week**, I will study for an exam" en: "**Next week**, I will study for an exam"
- ko: 다음 주 목요일은 휴가인가? - ko: "**다음** 주 목요일은 휴가인가?"
en: Is **next Thursday** a holiday? 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** 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 en: We are going to hold a meeting **next week** about that problem
- ko: 다음 달 - ko: 다음 달
@@ -283,7 +283,7 @@ vocabulary:
en: All the teachers **left** (went out) en: All the teachers **left** (went out)
- ko: 문을 열어서 밖으로 **나갔어요** - ko: 문을 열어서 밖으로 **나갔어요**
en: I opened the door and then **went outside** en: I opened the door and then **went outside**
- ko: 그는 방금 나갔어요 - ko: 그는 방금 **나갔어요**
en: He just **left** en: He just **left**
- ko: 쓰다 - ko: 쓰다
@@ -521,9 +521,9 @@ vocabulary:
몇 can also be used to mean "some." For example: 몇 can also be used to mean "some." For example:
- "저는 사과 몇 개를 샀어요" = "I bought some apples" (see Lesson 12 for more information) - "저는 사과 몇 개를 샀어요" = "I bought some apples" (see Lesson 12 for more information)
examples: examples:
- ko: 저는 친구 몇 명을 만났어요 - ko: 저는 친구 **몇** 명을 만났어요
en: I met **some** friends en: I met **some** friends
- ko: 친구가 몇 명 있어요? - ko: 친구가 **몇** 명 있어요?
en: "**How many** friends do you have?" en: "**How many** friends do you have?"
- ko: 층 - ko: 층
@@ -296,9 +296,9 @@ vocabulary:
en: The **picture** is hanging on the wall en: The **picture** is hanging on the wall
- ko: 저는 그 **그림**이 마음에 들어요 - ko: 저는 그 **그림**이 마음에 들어요
en: I like that **picture** en: I like that **picture**
- ko: "**그** 그림은 높은 가치가 있어요" - ko: "그 **그림**은 높은 가치가 있어요"
en: That **picture** has a high value en: That **picture** has a high value
- ko: 그 학생은 그림을 잘 그리는 재능을 가지고 있어요 - ko: 그 학생은 **그림**을 잘 그리는 재능을 가지고 있어요
en: That student has a talent for **drawing** (**pictures**) en: That student has a talent for **drawing** (**pictures**)
- ko: 그 **그림**을 볼 때 배경이 무슨 의미가 있는지 생각해 보세요 - ko: 그 **그림**을 볼 때 배경이 무슨 의미가 있는지 생각해 보세요
en: When you look at the **painting,** try to think about what meaning the background has en: When you look at the **painting,** try to think about what meaning the background has
@@ -448,7 +448,7 @@ vocabulary:
examples: examples:
- ko: 저는 숙제를 **나중에** 할 거예요 - ko: 저는 숙제를 **나중에** 할 거예요
en: I am going to do my homework **later** 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 en: There will not be any food **later**, therefore, I want to eat now
- ko: 선생님! 이 문제를 파악할 수 없어요. **나중**에 선생님의 교무실에 가도 돼요? - ko: 선생님! 이 문제를 파악할 수 없어요. **나중**에 선생님의 교무실에 가도 돼요?
en: Teacher! I can't grasp/understand this problem. May I go to your office **later**? en: Teacher! I can't grasp/understand this problem. May I go to your office **later**?
@@ -340,9 +340,9 @@ vocabulary:
audio: https://www.howtostudykorean.com/wp-content/uploads/2015/11/Lesson19v29.mp3 audio: https://www.howtostudykorean.com/wp-content/uploads/2015/11/Lesson19v29.mp3
en: less en: less
examples: examples:
- ko: 나는 남동생보다 덜 잘생겼어 - ko: 나는 남동생보다 **덜** 잘생겼어
audio: https://www.howtostudykorean.com/wp-content/uploads/2017/03/Lesson19-30.mp3 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: 한국에서 대학교는 고등학교보다 **덜** 어려워요 - ko: 한국에서 대학교는 고등학교보다 **덜** 어려워요
audio: https://www.howtostudykorean.com/wp-content/uploads/2017/03/Lesson19-31.mp3 audio: https://www.howtostudykorean.com/wp-content/uploads/2017/03/Lesson19-31.mp3
en: In Korea, University is **not as hard** as high school en: In Korea, University is **not as hard** as high school
@@ -188,9 +188,9 @@ vocabulary:
못하다 has the opposite meaning of 잘하다. For example: 못하다 has the opposite meaning of 잘하다. For example:
- "나는 수영을 못해" = "I am bad at swimming" - "나는 수영을 못해" = "I am bad at swimming"
examples: examples:
- ko: 나는 수영을 못해 - ko: 나는 수영을 **못해**
en: I am **bad at** swimming en: I am **bad at** swimming
- ko: 저 학생은 공부를 못해 - ko: 저 학생은 공부를 **못해**
audio: https://www.howtostudykorean.com/wp-content/uploads/2017/03/Lesson20-10.mp3 audio: https://www.howtostudykorean.com/wp-content/uploads/2017/03/Lesson20-10.mp3
en: That student does **not** study **well** en: That student does **not** study **well**
- ko: 제가 너무 부끄러워서 발표를 **못해요** - ko: 제가 너무 부끄러워서 발표를 **못해요**
@@ -406,9 +406,9 @@ vocabulary:
The usage of 못 is very complex. See below in this lesson for more information. The usage of 못 is very complex. See below in this lesson for more information.
examples: examples:
- ko: 저는 어제 시험을 못 봤어요 - ko: 저는 어제 시험을 **못** 봤어요
audio: https://www.howtostudykorean.com/wp-content/uploads/2017/03/Lesson20-12.mp3 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: 이 셔츠가 너무 작아서 **못** 입어요 - ko: 이 셔츠가 너무 작아서 **못** 입어요
en: I **can't** put this shirt on because it is too small en: I **can't** put this shirt on because it is too small
- ko: 저는 그 동안 공부를 **못** 했어요 - ko: 저는 그 동안 공부를 **못** 했어요
@@ -185,7 +185,7 @@ vocabulary:
en: I didn't see anybody/I saw **nobody** en: I didn't see anybody/I saw **nobody**
- ko: 저는 **아무도** 만나고 싶지 않아요 - ko: 저는 **아무도** 만나고 싶지 않아요
en: I don't want to meet anybody/I want to meet **nobody** en: I don't want to meet anybody/I want to meet **nobody**
- ko: 아무도 집에 가지 않았어요 - ko: "**아무도** 집에 가지 않았어요"
en: "**Nobody** went home" en: "**Nobody** went home"
- ko: 저는 그 말을 **아무에게도** 안 했어요 - ko: 저는 그 말을 **아무에게도** 안 했어요
en: I didn't say that to anybody/I said that to **nobody** en: I didn't say that to anybody/I said that to **nobody**
@@ -277,7 +277,7 @@ vocabulary:
examples: examples:
- ko: 돈이 없어서 갈 수 있는 **데**가 없었어요 - ko: 돈이 없어서 갈 수 있는 **데**가 없었어요
en: He had **nowhere** to go because he had no money 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 en: We went to the **place** that we met for the first time
- ko: 그녀가 사는 **데**는 조금 멀어요 - ko: 그녀가 사는 **데**는 조금 멀어요
en: She lives a little bit far (The **place** that she lives is a little far) en: She lives a little bit far (The **place** that she lives is a little far)