hanguleam/josa

Types

pub type JosaError {
  NoMatchingJosa
}

Constructors

  • NoMatchingJosa
pub type JosaPair {
  JosaPair(with_batchim: String, without_batchim: String)
}

Constructors

  • JosaPair(with_batchim: String, without_batchim: String)

Values

pub fn a_ya(word: String) -> Result(String, JosaError)

Selects “아” or “야” particle.

pub fn eul_reul(word: String) -> Result(String, JosaError)

Selects “을” or “를” particle.

pub fn eun_neun(word: String) -> Result(String, JosaError)

Selects “은” or “는” particle.

pub fn euro_ro(word: String) -> Result(String, JosaError)

Selects “으로” or “로” particle.

pub fn eurobuteo_robuteo(
  word: String,
) -> Result(String, JosaError)

Selects “으로부터” or “로부터” particle.

pub fn euroseo_roseo(word: String) -> Result(String, JosaError)

Selects “으로서” or “로서” particle.

pub fn eurosseo_rosseo(word: String) -> Result(String, JosaError)

Selects “으로써” or “로써” particle.

pub fn gwa_wa(word: String) -> Result(String, JosaError)

Selects “과” or “와” particle.

pub fn i_ga(word: String) -> Result(String, JosaError)

Selects “이” or “가” particle.

pub fn ieyo_yeoyo(word: String) -> Result(String, JosaError)

Selects “이에요” or “예요” particle.

pub fn ina_na(word: String) -> Result(String, JosaError)

Selects “이나” or “나” particle.

pub fn ira_ra(word: String) -> Result(String, JosaError)

Selects “이라” or “라” particle.

pub fn iran_ran(word: String) -> Result(String, JosaError)

Selects “이란” or “란” particle.

pub fn irang_rang(word: String) -> Result(String, JosaError)

Selects “이랑” or “랑” particle.

pub fn make_josa_selector(
  particle: String,
) -> fn(String) -> Result(String, JosaError)

Creates a reusable josa selector function for a specific particle. Returns a function that takes a word and selects the appropriate particle form.

Examples

let i_ga_selector = make_josa_selector("이")
let eul_reul_selector = make_josa_selector("을")

"하니" |> i_ga_selector   // -> Ok("가")
"달" |> i_ga_selector     // -> Ok("이")
"하니" |> eul_reul_selector // -> Ok("를")
"달" |> eul_reul_selector   // -> Ok("을")
pub fn pick(
  word: String,
  particle: String,
) -> Result(String, JosaError)

Selects the appropriate Korean particle (josa) for a given word based on its final character. Returns only the selected particle without attaching it to the word.

Examples

pick("하니", "이")  // -> Ok("가")
pick("달", "이")    // -> Ok("이")
pick("집", "으로")  // -> Ok("으로")
pick("학교", "으로") // -> Ok("로")
pick("하니", "xxx") // -> Error(NoMatchingJosa)
Search Document