Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Text Generation for Instances in the
Component Library
Ken Barker, Jarred McGinnis
Monday afternoon
Outline
• Motivation
– Why UT is doing text generation
• Interface
– What goes in and what comes out
• Customization
– How to adapt for new classes
• Future Work
– What to do next
Motivation
• the point of SHAKEN is to make formal KR
palatable to normal people, mostly through
graphical I/O (CMAPs)
• there are many places where even a CMAP is too
clunky or inappropriate
• English text is still the most efficient way to
describe some bit of knowledge
– interpreting English is still too hard
– generating English from KM is a little easier
Still Not Convinced?
This?
(*Manny has (instance-of (Person)) (trait ((a
Trait-Value with (value (*lazy))))) (size ((a
Size-Value with (value ((:pair *big
Person)))))))
(_Cage44 has (instance-of (Cage))
(is-possessed-by ((a Hamster with
(is-possessed-by (*Manny))))) (smell ((a
Smell-Value with (value (*stinky)))))
(capacity ((a Capacity-Value with (value
((:pair *capacious Cage)))))) (is-inside ((a
Room))) (is-near ((a Door))))
or This?
“Manny’s hamster’s
capacious stinky cage is
near the door and inside
the room.”
Shouldn’t This be part of SHAKEN?
• no.
• the lexicon and grammar rules are specific
to components
– each component must be responsible for its
own text generation
• any class can define its own text generation
words, phrases and rules
Generic vs. Component-Specific
generic:
component-specific:
“The entity move-intos the
tangible-entity with respect
to the tangible-entity along
the spatial-entity.”
“The agent moves the
object into the container
through the portal.”
“The entity let-falls the
tangible-entity.”
“The agent lets the object
fall.”
“The tangible-entity is
received to the tangibleentity from the tangibleentity.”
“The recipient receives the
object from the donor.”
Outline
• Motivation
– Why UT is doing text generation
• Interface
– What goes in and what comes out
• Customization
– How to adapt for new classes
• Future Work
– What to do next
Interface
• every instance of Entity and Event has a slot
called text-gen
– the text-gen of an Event is a sentence
• a single clause with the Event as the main verb and select
EventEntity slots as arguments
• can be redefined by any class
– the text-gen of an Entity is a noun phrase
• the Entity is the head noun, some property values are
premodifiers, some EntityEntity slots are postmodifiers,
determiner may include is-possessed-by
• can be redefined
– the text-sentence of an Entity is its text-gen
reworded as a sentence
• can be redefined
The text-gen of Entities
• for named instances… just the name!
KM> (the text-gen of *Manny)
("manny")
• for anonymous instances…
– <determiner> <premods> <head> <postmods>
KM> (the text-gen of _Cage44)
("manny's hamster's capacious stinky
cage near the door and inside the
room")
The text-sentence of Entities
• for named instances and anonymous instances…
– <determiner> <premods> <head> “is” <postmods>
KM> (the text-sentence of _Cage44)
("manny's hamster's capacious stinky cage is
near the door and inside the room.")
– <determiner> <head> “is” <postmods>
KM> (the text-sentence of _Room74)
("The room is inside the house.")
– <determiner> <head> “is” <premods>
KM> (the text-sentence of *Manny)
("Manny is big and lazy.")
– <determiner> <head> “is a” <Classes>
KM> (the text-sentence of _Hamster43)
("manny's hamster is a hamster.")
Heads
• for named instances… just the name!
• for anonymous instances…
– <Class> (<u-called> or <called>)
• for very general Entities (E, T-E, I-E, S-E, P) <Class> is the
Role played by the Entity
• otherwise, <Class> is one of the instance-of
KM> (make-phrase (the text-head of
(a Boy called "Sue")))
("boy (called Sue)")
KM> (make-phrase (the text-head of
(a Entity with (plays ((a Container))))))
("container")
Postmods
• is-part-of, material, content,
+ spatial rels (is-above, etc.)
• any class can define its own postmod slots
• for each of these slots that has a value…
– <the (the text-slot of It) of Self> “the” <the It of Self>
KM> (the text-slot of is-part-of)
(text-is-part-of)
KM> (the text-is-part-of of (a Knob))
("part of")
KM> (the is-part-of of (a Knob))
(_Door189)
KM> (make-phrase (the text-postmods of (a Knob)))
("part of the door")
Premods
• the properties (color, length, sex, etc.)
• for scalars…
– <scalar constant> only when the reference class is the
same as the instance-of of the Entity
• for categoricals…
– <categorical constant>
KM> (make-phrase (the text-premods of (*Manny)))
("big lazy")
Determiners
• for named instances
– <>
• for anonymous instances
– if the Entity is-possessed-by P
• <P’s <determiner> + <head>> “ ’s ”
– otherwise “the” or “a”
KM> (make-phrase (the text-def-determiner of (_Hamster43)))
("manny's")
KM> (make-phrase (the text-def-determiner of (_Cage44)))
("manny's hamster's")
KM> (make-phrase (the text-indef-determiner of (a Door)))
("a")
The text-gen of Events
• for “active” Events…
– <subject> <active-verbseq> <d-obj> <arguments>
KM> (the text-gen of _Move-Into49)
("The agent moves the object into the
container through the portal.")
• for “passive” Events…
– <d-obj> <passive-verbseq> <arguments>
KM> (the text-gen of (a Move-Into))
("The object gets moved into the container
through the portal.")
The <verbseqs> of Events
• <active-verbseq> and <passive-verbseq> defined for every
Event instance, with both singular and plural forms
KM> (the
("The
KM> (the
("The
KM> (the
text-gen of (a Break))
object gets broken.")
text-gen of (a Break with (agent ((a Entity)))))
agent breaks the object.")
text-gen of (a Break with
(agent ((a Living-Entity) (a Substance)))))
("The living-entity and the substance break the object.")
KM> (the text-gen of
(a Break with (object ((a Object) (a Bond)))))
("The object and the bond get broken.")
The <subject> of Events
• <det>+<head> of the agent or instrument (or some other role)
• for very general Entities, use the case name instead
KM> (the text-gen of
(a Move with (agent (_Hamster43))))
("Manny's hamster moves the object.")
KM> (the text-gen of (a Move with
(instrument ((a Tangible-Entity with
(plays ((a Vehicle))))))))
("The vehicle moves the object.")
KM> (the text-gen of
(a Receive with (recipient (*Manny))))
("Manny receives the object.")
The <d-obj> of Events
• <det>+<head> of the object (or some other role)
• for very general Entities, use the case name instead
• if there is no object, use “something”
KM> (the text-gen of
(a Move with (object (_Hamster43))))
("Manny's hamster moves.")
KM> (the text-gen of (a Move with
(instrument ((a Tangible-Entity with
(plays ((a Vehicle))))))))
("The vehicle moves the object.")
KM> (the text-gen of (a Produce))
("The result gets produced from the raw-material.")
The <arguments> of Events
• <text-slot>+<slot> for some list of slots
• for very general Entities, use the case name instead
KM> (the text-gen of
(a Store with (base ((a Tangible-Entity)))))
("The object gets stored in the base.")
KM> (the text-gen of
(a Withdraw with (base ((a Tangible-Entity)))))
("The object gets withdrawn from the base.")
KM> (the text-gen of
(a Enter with (base ((a Tangible-Entity)))))
("The object enters the container through the portal.")
KM> (the text-gen of _Move138)
("The wheel moves manny's hamster from the cage
to the door.")
text-particle
• one more thing…
– some verbs have particles that are part of the verbseq,
but may be separated from the main verb
• look up a number look it up
– the text-particle slot can appear anywhere among
the arguments
KM> (the text-gen of (a Knock-Down))
("Something gets knocked down.")
KM> (the text-gen of (a Knock-Down with
(agent ((a Entity))) (object ((a Object)))))
("The agent knocks the object down.")
The text-gen of States
• mostly covered by the text-gen of Events
– the <active-verbseq> is by default “keeps”
– the <passive-verbseq> is by default “is”
– the state itself is handled by text-particle
KM> (the text-gen of (a Be-Accessible))
("The object is accessible.")
KM> (the text-gen of (a Be-Accessible with
(agent ((a Entity)))))
("The agent keeps the object accessible.")
Outline
• Motivation
– Why UT is doing text generation
• Interface
– What goes in and what comes out
• Customization
– How to adapt for new classes
• Future Work
– What to do next
Customizing Text Generation
• the text generation system involves 33 special
slots that specify the words used in text generation
and the rules for combining them
• all slots are inherit-with-overrides so any
subclass can redefine any part of text generation
• all slots are dont-cache-values so when
instances change their text-gen changes
Roll Your Own
• usually the inherited text generation machinery is
good enough for new classes
KM> (Sneak-In has (superclasses (Enter)))
(Sneak-In)
KM> (the text-gen of (a Sneak-In with
(base ((a Theater)))))
("The object enters the theater through the
portal.")
Roll Your Own (cont.)
• customizing text generation for a new Event class
usually involves changes to only a few “lexicon”
slots
KM> (every Sneak-In has
(text-active-verbseq-sg ("sneaks"))
(text-active-verbseq-pl ("sneak"))
(text-base ("into")))
(Sneak-In)
KM> (the text-gen of (a Sneak-In with
(base ((a Theater)))))
("The object sneaks into the theater through
the portal.")
Roll Your Own (cont.)
• sometimes customization demands more
KM> (Bequeath has (superclasses (Action)))
KM> (every Bequeath has (donor ((a Entity)))
(recipient ((a Entity))))
KM> (the text-gen of (a Bequeath))
("Something has bequeath done to it.")
KM> (every Bequeath has
(text-active-verbseq-sg ("bequeaths"))
(text-active-verbseq-pl ("bequeath"))
(text-passive-verbseq-sg ("is bequeathed"))
(text-passive-verbseq-pl ("are bequeathed"))
(text-subj ((the donor of Self)))
(text-argslots ((:seq recipient instrument)))
(text-recipient ("to"))
(text-instrument ("in")))
KM> (the text-gen of (a Bequeath with
(object ((a Money))) (instrument ((a Will)))))
("The donor bequeaths the money to the object in the
will.")
Outline
• Motivation
– Why UT is doing text generation
• Interface
– What goes in and what comes out
• Customization
– How to adapt for new classes
• Future Work
– What to do next
Future Work
1. stop working on text gen, dammit!