Hacker News new | ask | show | jobs
by stephengillie 3374 days ago
Using particles in this way almost sounds like using flags to specify parameters when calling a function. This allows them to be placed in any order. A Powershell-like example:

  Construct-Sentence -subject Taro -object Noriko -verb to_see -time Past  
  > "Taro saw Noriko."

  Construct-Sentence -object Noriko -time Past -verb to_see -subject Taro 
  > "Taro saw Noriko."
The original sentence is "Tarō wa Noriko wo mimashita." And "masu" appears to be the root verb "to see".

  Construct-Sentence -wa Taro -wo Noriko -verb masu -time Past
  > "Tarō wa Noriko wo mimashita."
Something more Bash-like:

  csent wa:Taro wo:Noriko masu -past_affirmative
  # "Tarō wa Noriko wo mimashita."
Meanwhile, subject-object-verb (SVO) and similar patterns depend on the order of inputs:

  Construct-Sentence Taro Norkio to_see Past
  > "Taro saw Noriko"

  Construct-Sentence Norkio Taro to_see Past
  > "Noriko saw Taro"
This allows for invalid outputs:

  Construct-Sentence Taro to_see Norkio Past
  > "Taro Noriko'ed see"
1 comments

I've made the analogy of function calls before, it's a pretty cool way to think about it. But I think your example is slightly off. The verb is the head of the phrase, and would thus be the function (or command) itself:

    miru --topic=Taro --object=Noriko # Taro sees Noriko
This uses "miru", the plain non-past form of "to see". Conjugating the verb is a little trickier to translate, but I think it would be analogous to higher-order functions, functions that modify the verb to create a new verb. Using a Python-like syntax:

    formal(past(miru))(topic="Taro", object="Noriko")
    # Taro wa Noriko wo mimashita
I'm trying to think of a way to include relative clauses in this analogy, but it's a little harder. A relative clause is of the form "[verb-phrase] [noun]", e.g. "doresu wo kiru Noriko" (Noriko who wears a dress). Maybe we could use positional arguments for this:

    formal(past(miru))(topic="Taro", object=kiru(object="doresu", "Noriko"))
    # Taro wa doresu wo kiru Noriko wo mimashita ??
EDIT: or maybe currying would be a nice way to solve this. So each verb would be a function that takes arguments, and returns a new function that takes a noun to apply that verb to:

    formal(past(miru))(topic="Taro", object=kiru(object="doresu")("Noriko"))
    # Taro wa doresu wo kiru Noriko wo mimashita
Could this situation be described by nesting sentences?

  "Taro saw (Noriko wears a dress)."
To extend your example:

  formal(past(miru))(topic="Taro", object="Noriko")
  "Taro saw Noriko."

  formal(present(kiru))(topic="Noriko", object="doresu") 
  "Noriko wears a dress."
Nested:

  formal(past(miru))(topic="Taro", object=(formal(present(kiru))(topic="Noriko", object="doresu")) )

  "Taro saw (Noriko wears a dress)."
  "Taro saw Noriko wear a dress."

  "Taro wa (doresu wo kiru Noriko wa(?)) wo mimashita"
  "Taro wa doresu wo kiru Noriko wo mimashita"
Does that make sense?

*Please help correct any errors, as I have never formally studied the Japanese language.

It wouldn't type-check, since `object` is expected to be a noun and not a verb. :)
It's a difficulty inherent in describing one unfamiliar language with another unfamiliar language. :)

This could work in Powershell. The function would have to be written to expect nested recursive calls, to remove the omitted particle.

  Construct-Sentence -verb miru -Formal -Past -Topic Taro -Object (
  Construct-Sentence -verb kiru -Formal -Present -Topic Noriko -Object doresu
  )

  "Taro saw (Noriko wears a dress)."
  "Taro saw Noriko wear a dress."

  "Taro wa (doresu wo kiru Noriko wa(?)) wo mimashita"
  "Taro wa doresu wo kiru Noriko wo mimashita"