Skip to content

Instantly share code, notes, and snippets.

@eignnx
Last active July 2, 2020 22:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eignnx/c8a86ad07133e59de1c92f2c30a85734 to your computer and use it in GitHub Desktop.
Save eignnx/c8a86ad07133e59de1c92f2c30a85734 to your computer and use it in GitHub Desktop.
data Number = singular | plural
data Person = 1st | 2nd | 3rd
data Gender = nonbinary | feminine | masculine | neutral
rule start = english_sentence + "."
rule english_sentence
= pronoun.Number.Person.Gender are.Number.Person.Gender adj
| subj.N1.G1 verb.N1.G1 obj.N2.G2
rule pronoun.Number.Person.Gender =
.singular {
.1st.* -> "I"
.2nd.* -> "you"
.3rd {
.nonbinary -> "they"
.feminine -> "she"
.masculine -> "he"
.neutral -> "it"
}
}
.plural {
.1st.* -> "we"
.2nd.masculine -> "you guys" | pronoun.plural.2nd.neutral
.2nd.* -> "you" | "y'all"
.3rd.* -> "they"
}
rule are.Number.Person.Gender =
.singular {
.1st.* -> "am"
.2nd.* -> "are"
.3rd {
.nonbinary -> "are"
.* -> "is"
}
}
.plural.*.* -> "are"
rule adj
= "wholesome"
| "Russian"
| "tall"
rule subj.Number.Gender =
.Number.Gender -> pronoun.Number.Person.Gender
| article.StartSound.Number noun.StartSound.Number
data StartSound = consonant | vowel
rule article.StartSound.Number =
.consonant.singular -> "the" | "a"
.vowel.singular -> "the" | "an"
.*.plural -> "some" | "a few" | "several" | "two"
rule noun.StartSound.Number =
.consonant.singular -> "cat" | "person" | "boat"
.consonant.plural -> "cats" | "people" | "boats"
.vowel.singular -> "hour" | "eagle"
.vowel.plural -> "hours" | "eagles"
rule obj.Number.Gender = .N.G -> subj.N.G
rule verb.Number.Person.Gender =
.singular.*.nonbinary -> verb.plural.3rd.neutral
.plural.3rd.neutral -> "eats"
| "plays"
| "sleeps"
.*.* -> "DOES SOMETHING"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment