Download presentation
Presentation is loading. Please wait.
Published byPriscilla Robertson Modified over 9 years ago
1
Xiao Liu, Dinghao Wu {xvl5190, dwu}@ist.psu.edu SSS (Software Systems Security) Lab The Pennsylvania State University September 2014 IEEE/ACM International Conference on Automated Software Engineering PiE: Programming in Eliza
2
Outline Problem Description Background System PiE-Script Techniques Evaluation Future Work 2
3
Problem Description Motivation –Program Syntax is too difficult for beginners When command is confusing When command is long –Program in different languages is a headache even for experienced programmers When commands are different between platforms Need –Reinvent a way for people to program in Natural Language that Simplifies the way people program –Invent a tool that Lowers the entrance bar for beginners, especially the kids 3
4
Background ELIZA –J Weizenbaum - CACM, 1966 –First generation AI prototype –Dialogue System –Rule-Based LOGO –Feurzeig and Papert 1967 –Graphic-oriented language for education –Draw with a turtle 4
5
System 5
6
6 Can you go forward 100 steps? Sure, Let’s forward 100 steps! Sure, Let’s (PredicateTok)(NumberTo k) Steps! (RedundantTok)+(PredicateTok)+ (NumberTok)+(RedundantTok) FD 100
7
PiE Script 7 Statement [Color of the Pen] >Would you please let the color of the pen be blue? S := pencolor blue transform(blue) := [0,0,255] Function [Define Functions] >Let’s begin with forward a line with length 200! >Then let’s just turn left. >Let STEP be the last two commands! S1 := forward number number := 200 S2 :=turn direction direction := left STEP := last[number] number := 2 last[2] := foreach n in number, STEP = STEP + last[n] Repeat [Start Loops] >let’s repeat STEP for four times S := foreach n in number, do STEP number := 4 Statement S ::= (π|T)(I|T) Parameter I ::= number |direction|color|Ω Omission Ω ::= number |direction|color Predicate π ::= Predicate (a1, a2,..., an) Repeat R ::= S | foreach x ∈ a, do S1; S2;...; Sn; od Transform T ::= t1; t2;...; tn t ::=transform(a) |transform(I ) Argument a ::= input(a1, a2,…)
8
Technique-1 Regular Expression Matching –Number Token: (\d*) Move ahead 100 steps. Turn 45 degrees to the left Turtle! –Color Token: ((\d)* \s){3} Can you use a blue pen. –Direction Token: (left|right|east|north|west|south) Can you turn to the south turtle? Rotate to the left side! –Predicate Token: (forward|backward|repeat|...) Please repeat the last two steps for 3 more times. Draw a circle the radius is 100 units. 8
9
Technique-2 Rules –(\.*)(forward|ahead)(\. ∗ )(\d ∗ )(\. ∗ ) Turtle, Can you forward 100 steps. Forward 100 steps to the front, turtle! Go forward please for 100 steps! Move forward 100 steps, Go! Quickly move ahead 100 units! Can you go ahead 100 steps? Can you move forward for 100 steps? We made rules that matches natural language descriptions which are quite freely composed. 9
10
Technique-2 Rules –(\. ∗ )(turn|rotate)(\d ∗ )(.*)(left|right)(\. ∗ ) –(\. ∗ )(\d ∗ )(.*)(left|right)(\. ∗ ) Please turn 100 degrees to the left! Turn 90 degrees right! Make a 90 degree right turn please! Rotate 45 degrees to the left! Turn turtle, 45 degrees to the right! Can you rotate 45 degrees to the right? Normally, a few rules can be used to match many natural language descriptions. High Efficiency! 10
11
Technique-3 Ranking & Prune –We rank the rules in two steps: by Predicate Order –Forward is set before PenColor (Use Frequency) by Complex Order –More Complexity: More tokens or RedundantTok –We prune the rules by testing: Sort the rules in one class by Complex Order Prune the one with higher Complexity – ✖ (\. ∗ ) forward a line of (\d ∗ ) (\. ∗ ) in length – ✖ (\. ∗ ) forward a line of (\d ∗ ) (\. ∗ ) long – ✔ (\. ∗ )forward(\. ∗ ) (\d ∗ ) (\. ∗ ) 11
12
Technique-4 Dialog Interaction –Based on the ELIZA system. 12 [PiE Start] Thanks for trying PiE. How can I help you? > Let’s first draw a line Okay, what is the length of that line? > Oh, I mean, to define a function called line I see, what are the arguments of the function Line? > They are count and n Okay, I have designed a function called Line with input arguments called count and n. Then? > let the turtle move ahead n steps when the count equals to one Okay, if the Count is 1, turtle will forward N steps > In other cases, do the following things: I see. do what else? > let count decrease by one Okay, Count equals to Count -1.
13
Technique-4 Continue 13 > repeat the line function with new count I see. Function Line is called with the new argument count > turn left 60 degrees Okay, the turtle turns 60 degrees to the left > repeat the function line Okay, Function Line is called > turn right 120 degree and repeat function line I see, the turtle turns 120 degrees to the right. Function Line is called. > Again turn but left 60 degrees and repeat the function line Okay, the turtle turns 60 degrees to the left. Function Line is called > That is all for the function I see, Function Line is end > repeat the line function with new count I see. Function Line is called with the new argument count > turn left 60 degrees Okay, the turtle turns 60 degrees to the left
14
Technique-4 Continue 14 > repeat the function line Okay, Function Line is called > turn right 120 degree and repeat function line I see, the turtle turns 120 degrees to the right. Function Line is called. > Again turn but left 60 degrees and repeat the function line Okay, the turtle turns 60 degrees to the left. Function Line is called > That is all for the function I see, Function Line is end > Start another function called Koch I see, what are the arguments of the function Koch? > still count and n Okay, I have designed a function called Koch with input arguments called count and n. Then? > first turn right 30 degrees and execute the function line I see. The turtle turns 30 degrees to the right. Function Line is called.
15
Technique-4 Continue 15 > turn right 120 degrees and execute the function line I see. The turtle turns 120 degrees to the right. Function Line is called. > repeat the last command I see. The turtle turns 120 degrees to the right. Function Line is called. > Let’s call it Koch I see, Function Koch is end. > Clear everything Okay, the canvas is clean. > let the turtle start from point (45,370) I see, turtle is moved to point (45,370). > Begin the function Koch Okay, but what are the arguments? > count is 5 and n is 5 Okay, function Koch is called with the argument Count=5 and n=5. > Quit Okay, Done!
16
Technique-4 LOGO Program & Output Graph 16 to line :count :n ifelse :count = 1 [fd :n] make "count :count - 1 line :count :n lt 60 line :count :n rt 120 line :count :n lt 60 line :count :n End to koch :count : rt 30 line :count :n rt 120 line :count :n rt 30 line :count :n End clear setxy 45 370 Koch 55 Done
17
Evaluation Success Ratio (88.7%) –1,877 natural language descriptions –19 benchmarks –Collected when users are doing tasks or playing Learning Efficiency –6 volunteers in different levels of programming experiences: laymen, novices, experts –Same task: draw a same graph using PiE and LOGO –Time saving: 22.39%, 21.74%, 43.85% 17
18
Future Works Complete User Study –Large scale –Kid’s Education Multi-lingual Interface –French –Chinese 18
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.