Skip to content

Instantly share code, notes, and snippets.

@eignnx
Last active December 31, 2020 23:36
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/1742fcee704f3613dde2eb67c83371e7 to your computer and use it in GitHub Desktop.
Save eignnx/1742fcee704f3613dde2eb67c83371e7 to your computer and use it in GitHub Desktop.
-- # Generating Center Embeddings
-- [This wikipedia article](https://en.wikipedia.org/wiki/Center_embedding) is about a kind of sentence that is REALLY hard to understand. Click the "Generate" button in the top right to generate sentences!
rule start = center_embedding
rule center_embedding = subject verb_phrase + "."
rule verb_phrase
= "slept"
| "killed" subject
| "longed for the sea"
| "was murdered on the high seas"
| "visited" subject
rule subject
= article[Subj] @Subj
| article[Subj] @Subj "[ {" + that + "}" subject intermediate_verb "]"
data Subj
= dog ("dog")
| cat ("cat")
| hamster ("hamster")
| porcupine ("porcupine")
| ostrich ("ostrich")
| giraffe ("giraffe")
| sea_turtle ("sea turtle")
| aardvark ("aardvark")
| porpoise ("porpoise")
| dash_hound ("dash hound")
| pterodactly ("pterodactyl")
rule article[Subj] =
[ostrich] -> "an" | "the"
[aardvark] -> "an" | "the"
[?] -> "a" | "the"
rule that = "that" | "who" | " "
rule intermediate_verb
= "loved"
| "spat upon"
| "saw"
| "intended to kill"
| "arrested"
| "plucked"
| "avoided"
| "was attracted to"
| "had observed carefully"
| "annoyed"
| "consumed"
| "minimized"
| "treated harshly in the workplace"
| "patronized"
| "complemented"
| "insulted"
@eignnx
Copy link
Author

eignnx commented May 2, 2020

view generated sentences here.

@book646
Copy link

book646 commented May 2, 2020

@eignnx
Copy link
Author

eignnx commented May 2, 2020

@book646 谢谢! 您可以通过链接尝试一下吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment