320 likes | 526 Views
SmartSynth : Synthesizing Smartphone Automation Scripts from Natural Language. Vu Le (UC Davis) Sumit Gulwani (MSR Redmond) Zhendong Su (UC Davis). motivation. programming. Tasker. App Inventor. natural language.
E N D
SmartSynth: Synthesizing Smartphone Automation Scripts from Natural Language Vu Le (UC Davis) Sumit Gulwani (MSR Redmond) Zhendong Su (UC Davis)
programming Tasker App Inventor
natural language When I receive a new SMS, if the phone is connected to my car’s bluetooth, it reads the message content and replies the sender “I’m driving.”
script when(number, content) := MessageReceived() if(IsConnectedToBTDevice(Car_BT) then Speak(content); SendMessage(number, "I'm driving");
SmartScript Script P ::= I E T C M Parameter I ::= input (i1, …, in) | ε Event E ::= (r1, …,rn):= whenEvent() | ε Conversions T ::= F1; …; Fn; Condition C ::= if (Π1 ∧ … ∧ Πn) then | ε Body M ::= Stmt1; … ; Stmtn; Conversion F ::= x := Convert(a) Predicate Π ::= Predicate (a1, …, an) Statement Stmt ::= S | foreachx in a doS1; … ; Sn; od Atomic Stmt. S ::= A | F Action A ::= (r1, …, rn):= Action(a1, …, an) Argument a ::= x | i | r | l
approach Script = Components + Relations
approach Script = Components + Relations
approach Script = Components + Relations
approach Script = Components + Relations
definition • Component • API: MessageReceived • Entity • Literal: “I’m driving” • API return value: MessageReceived.TextO • Relation = <Entity, API parameter> • E.g., < “I’m driving”, SendMessage.TextI>
mapping features • Regular expressions • Bag of words • Phrase length • Punctuation • Parse tree (Stanford NLP parser)
relation discovery • Rule-based relation detection • Relative locations of APIs and entities
script generation when(number, content) := MessageReceived() if(IsConnectedToBTDevice(Car_BT) then Speak(content); SendMessage(number, "I'm driving");
incompleteness when(number, content) := MessageReceived() if(IsConnectedToBTDevice(Car_BT) then Speak(content); SendMessage(number, "I'm driving");
insight NLP + Program Synthesis
ambiguity {MessagedReceived, IsConnectedToBTDevice, Car_BT, Speak, MessageReceived.TextO, (SendMessage OR SendEmail), "I'm driving“ } SendMessage SendEmails Synthesizer Script 1 Script 2 Ranking Script 1 (SendMessage)
incompleteness • Search for most likely missing relations
q & a • Distinguishing multiple choice questions • Question: API parameter • Answers: Equally-likely related entities What do you want the phone to speak? The received message content “I’m driving”
evaluation • 50 scripts collected from user forums • User study: give NL descriptions from scripts • 11 students participated • Each student was given 25 problems • 640 correct descriptions (725 total)
related work • General purpose programming using natural language • Natural language interfaces • Specification extraction from natural language
thank you NLP Script = Components + Relations Identify Detect Resolve Complete Program Synthesis
v.s. Siri Single phone API Composition of APIs Conversation SmartSynth Siri