|
Speed Challenge 36: How to order a sandwich
Last post 04-19-2008 4:15 PM by djmaze. 19 replies.
-
08-16-2007 8:50 AM
|
|
-
JvdL


- Joined on 01-26-2007
- Spain
- Posts 177
|
Speed Challenge 36: How to order a sandwich
Here's a complaint from a sandwich artist
sandwich artist:
I’ve worked at Subway for nearly a year now. One of the most
frustrating things to me in my job: customers who don’t know how to
order a sandwich! They usually preface their requests with phrases like
“This is going to be really easy” and then proceed to say “I want three
sandwiches, with everything on them, and no pickles on the first one,
no tomatos or jalopenos on the second, and everything on the third. No,
wait. Make that the second. Okay?”
Here’s the deal. Besides being way too much for me to remember, the customer needs to realize that I
am the one making the sandwich. I will ask appropriate questions at the
appropriate times. Before vegetables, these are the questions I ask:
What size sandwiches are you getting? What kind of bread would you like? What kind of sandwiches are these? What kind of cheese do you want? Would you like this toasted?
I can’t memorize a vegetable list when I have to deal with all that other information first.
The challenge is help the sandwich person in his job by making a program that takes a plain English strings like this
I want three
sandwiches, with everything on them, and no pickles on the first one,
no tomatos or jalopenos on the second, and everything on the third. No,
wait. Make that the second. Okay?
And generates a list of processing instructions of, like this.
- rye,turkey,swiss,lettuce,tomatoes,jalopenos
- rye,turkey,swiss,lettuce,pickles
- rye,turkey,swiss,lettuce,pickles,tomatoes,jalopenos
The program may use a fixed list of bread types, meats, cheeses and condiments, with defaults for each of them. Get inspiration here.
|
|
-
-
too_many_usernames


- Joined on 12-09-2005
- (0,0,0) local
- Posts 213
|
Re: Speed Challenge 36: How to order a sandwich
I think you might need a new challenge here... there don't seem to be any takers on this one. (Not sure it fits into the "Speed" category as I don't know of anyone that can do this without faking it similar to the old text games. See http://www.homestarrunner.com/dungeonman.html)
|
|
-
-
Mystery


- Joined on 01-03-2006
- Posts 7
|
Re: Speed Challenge 36: How to order a sandwich
This should be easy in IRP.
|
|
-
-
too_many_usernames


- Joined on 12-09-2005
- (0,0,0) local
- Posts 213
|
Re: Speed Challenge 36: How to order a sandwich
Mystery:This should be easy in IRP.
So would that be a reverse Turing test? Have a person answer and see if you can tell it's a computer?
|
|
-
-
tster


- Joined on 04-11-2006
- Natick, MA
- Posts 1,765
|
Re: Speed Challenge 36: How to order a sandwich
JvdL:Here's a complaint from a sandwich artist
sandwich artist:
I’ve worked at Subway for nearly a year now. One of the most
frustrating things to me in my job: customers who don’t know how to
order a sandwich! They usually preface their requests with phrases like
“This is going to be really easy” and then proceed to say “I want three
sandwiches, with everything on them, and no pickles on the first one,
no tomatos or jalopenos on the second, and everything on the third. No,
wait. Make that the second. Okay?”
Here’s the deal. Besides being way too much for me to remember, the customer needs to realize that I
am the one making the sandwich. I will ask appropriate questions at the
appropriate times. Before vegetables, these are the questions I ask:
What size sandwiches are you getting? What kind of bread would you like? What kind of sandwiches are these? What kind of cheese do you want? Would you like this toasted?
I can’t memorize a vegetable list when I have to deal with all that other information first.
The challenge is help the sandwich person in his job by making a program that takes a plain English strings like this
I want three
sandwiches, with everything on them, and no pickles on the first one,
no tomatos or jalopenos on the second, and everything on the third. No,
wait. Make that the second. Okay?
And generates a list of processing instructions of, like this.
- rye,turkey,swiss,lettuce,tomatoes,jalopenos
- rye,turkey,swiss,lettuce,pickles
- rye,turkey,swiss,lettuce,pickles,tomatoes,jalopenos
The program may use a fixed list of bread types, meats, cheeses and condiments, with defaults for each of them. Get inspiration here.
The best thing to do is to slap the little prick and tell him that if he's going to complain about customers ordering sandwiches with vegetables on them then he can find a new job. Perhaps he should do his best to remember and then if he forgets just ask the damn question again. I would fire this complainer in a second for having such a bad attitude towards customers.
The pig go. Go is to the fountain. The pig put foot. Grunt. Foot in what? ketchup. The dove fly. Fly is in sky. The dove drop something. The something on the pig. The pig disgusting... see bio for the earth shattering ending.
|
|
-
-
PSWorx


- Joined on 04-28-2006
- Posts 888
|
Re: Speed Challenge 36: How to order a sandwich
tster: JvdL:Here's a complaint from a sandwich artist
sandwich artist:
I’ve worked at Subway for nearly a year now. One of the most
frustrating things to me in my job: customers who don’t know how to
order a sandwich! They usually preface their requests with phrases like
“This is going to be really easy” and then proceed to say “I want three
sandwiches, with everything on them, and no pickles on the first one,
no tomatos or jalopenos on the second, and everything on the third. No,
wait. Make that the second. Okay?”
Here’s the deal. Besides being way too much for me to remember, the customer needs to realize that I
am the one making the sandwich. I will ask appropriate questions at the
appropriate times. Before vegetables, these are the questions I ask:
What size sandwiches are you getting? What kind of bread would you like? What kind of sandwiches are these? What kind of cheese do you want? Would you like this toasted?
I can’t memorize a vegetable list when I have to deal with all that other information first.
The challenge is help the sandwich person in his job by making a program that takes a plain English strings like this
I want three
sandwiches, with everything on them, and no pickles on the first one,
no tomatos or jalopenos on the second, and everything on the third. No,
wait. Make that the second. Okay?
And generates a list of processing instructions of, like this.
- rye,turkey,swiss,lettuce,tomatoes,jalopenos
- rye,turkey,swiss,lettuce,pickles
- rye,turkey,swiss,lettuce,pickles,tomatoes,jalopenos
The program may use a fixed list of bread types, meats, cheeses and condiments, with defaults for each of them. Get inspiration here.
The best thing to do is to slap the little prick and tell him that if he's going to complain about customers ordering sandwiches with vegetables on them then he can find a new job. Perhaps he should do his best to remember and then if he forgets just ask the damn question again. I would fire this complainer in a second for having such a bad attitude towards customers.
That's probably exactly what he did. At least that's what all Subway "sandwich artists" did that I ever had to do with. And I don't see how it should be bad if he vents his anger in an online blog where it can't do any harm and is informational as well even. People behave differently online and offline, you know.
As for the challenge I'm not sure if it's possible at all. It should be pretty easy to "translate" sentences that are structured exactly like the above one but for it to be really useful, you'd have to take into account the dozens of different formulations customers could use. How should a program be written, that accepts both the above sentence and, let's lay, "Good Morning! I get a six-inch turkey sandwich with no tomatos or jalopenos. Oh, my daughter wants one too but with no pickles instead. And make one with everything for my wife here." and returns the same output. I don't think it's possible. Also, how about ambiguous or incomplete sentences where you'd have to ask questions? This isn't to realize in a simple input/output pattern at all.
|
|
-
-
JvdL


- Joined on 01-26-2007
- Spain
- Posts 177
|
Re: Speed Challenge 36: How to order a sandwich
This is not as difficult as it seems. There is only one action a sandwich artist can do: make a sandwich. It is not an AI that needs to understand natural language, just extract a list of predefined items from a sentence. For this, it needs to find words that match a predefined list of bread types, flavors (meats and cheeses) and condiments; including words like "everything". Secondly, it needs to understand cardinals (a, one, two, ..), ordinals (first, second, "first one", ..) and negations (no, not, without, ...)
For sake of arguments, let's define following word categories (the first one being default)
- bread-type = (rye,six-inch,...)
- flavors = (chicken,turkey,cheese,...)
- condiments = (mayo,tomatoes,jalopenos,pickles,...)
In a first pass, split the sentence in phrases (using interpunction separators) and remove noise (anything that's not a predefined word, cardinal, ordinal or negation), like thus:
Good Morning! I get a six-inch turkey sandwich with no tomatoes or jalopenos. Oh, my daughter wants one too but with no pickles instead. And make one with everything for my wife here.
| Good Morning |
- |
| I get a six-inch turkey sandwich with no tomatoes or jalopenos |
[1] six-inch turkey [no] tomatoes jalopenos |
| Oh |
- |
| my daughter wants one too but with no pickles instead |
[1] [no] pickles |
| And make one with everything for my wife here |
[1] everything |
I want three sandwiches, with everything on them, and no pickles on the first one, no tomatoes or jalopenos on the second, and everything on the third. No, wait. Make that the second. Okay?
| I want three sandwiches |
[3] |
| with everything on them |
everything |
| and no pickles on the first one |
[no] pickles [#1] |
| no tomatos or jalopenos on the second |
[no] tomatoes jalopenos [#2] |
| and everything on the third |
everything [#3] |
| No |
[no] |
| wait |
- |
| Make that the second |
[#2] |
| Okay |
- |
Now apply some simple rules of thumb like this:
- categories (bread type, flavors, condiments) apply to all following until an item from that category occurs
- in absence of an explicit bread type or flavors, use default
- in absence of an explicit bread condiment, use all
- negation applies to what follows in the same phrase
- ordinals applies to entire phrase
- cardinal starts new sandwiches
- "everything" stands for all condiments
- more rules of thumb based on other test input...
- skip anything that doesn't conform to a rule.
The two sample phrase now boil down to this
| [1] six-inch turkey [no] tomatoes jalopenos |
[1] (six-inch) (turkey) (mayo,pickles) |
| [1] [no] pickles |
[1] (six-inch) (turkey) (mayo,tomatoes,jalopenos) |
| [1] everything |
[1] (six-inch) (turkey) (mayo,tomatoes,jalopenos,pickles) |
| [3] everything |
[3] (rye) (turkey) (mayo,tomatoes,jalopenos,pickles) |
| [#1] [no] pickles |
[#1] (rye) (turkey) (mayo,tomatoes,jalopenos) |
| [#2] [no] tomatoes jalopenos |
[#2] (rye) (turkey) (mayo,pickles) |
| [#3] everything |
[#3] (rye) (turkey) (mayo,tomatoes,jalopenos,pickles) |
| [no] |
- |
| [#2] |
- |
This seems to be adequate for the given input, except for the phrase No, wait. Make that the second, which frankly I don't quite understand what that is supposed to mean anyways. Granted, to fine tune this for a large amount of test input requires iterative improvements of the rules, which takes time but is not extremely difficult.
|
|
-
-
Random832


- Joined on 05-09-2007
- Posts 482
|
Re: Speed Challenge 36: How to order a sandwich
JvdL:
Good Morning! I get a six-inch turkey sandwich with no tomatoes or jalapeños. Oh, my daughter wants one too but with no pickles instead. And make one with everything for my wife here.
| Good Morning |
- |
| I get a six-inch turkey sandwich with no tomatoes or jalapeños |
[1] six-inch turkey [no] tomatoes jalapeños does the sandwich have jalapeños or not? |
| I get a six-inch turkey sandwich with no tomatoes but with jalapeños |
| Oh |
- |
| my daughter wants one too but with no pickles instead |
[1] [no] pickles (with "either" instead of "instead", the meaning would change as to whether [#2] has tomatoes and jalapeños)
|
| And make one with everything for my wife here |
[1] everything
|
[...]
This seems to be adequate for the given input, except for the phrase No, wait. Make that the second, which frankly I don't quite understand what that is supposed to mean anyways.
That means that the previous statement should apply to [#2] instead of whatever ordinal was parsed originally. Not so easy, is it?
|
|
-
-
GeneWitch


- Joined on 12-23-2006
- Orange County, CA
- Posts 310
|
Re: Speed Challenge 36: How to order a sandwich
Here's the code in Lolcode:
I can has cheezburger?
I can has drink wiv flavor?
kthxbai
sudo make me a sandwich
|
|
-
-
Hatshepsut


- Joined on 07-26-2007
- Posts 40
|
Re: Speed Challenge 36: How to order a sandwich
GeneWitch:sudo make me a sandwich
I think you nailed this one.
|
|
-
-
aib


- Joined on 01-03-2007
- Posts 88
|
Re: Speed Challenge 36: How to order a sandwich
Hatshepsut: GeneWitch:sudo make me a sandwich
I think you nailed this one.
Meh, I was too late to say "sudo order me a sandwich."
I may or may not have meant what I've said above.
|
|
-
-
MarcB


- Joined on 10-24-2006
- Posts 511
|
Re: Speed Challenge 36: How to order a sandwich
JvdL:
| Good Morning |
- |
| I get a six-inch turkey sandwich with no tomatoes or jalopenos |
[1] six-inch turkey [no] tomatoes jalopenos |
| Oh |
- |
| my daughter wants one too but with no pickles instead |
[1] [no] pickles |
| And make one with everything for my wife here |
[1] everything |
Ok. So how do you get this program to parse English. "with no tomateos or jalapenos" is fine. But what about "no jalapenos and tomatoes"? - no(jalapeños and no(tomatoes)?
- no(jalapeños) and yes(tomatoes)?
Or the "no pickles instead"? I don't see any pickles explicitly included in Dad's sandwich. If you want just bread + meat at Subway, that's what they'll give you. So is the daughter going to end up with a bun and some turkey in it? Same for dad, since he's not saying "pile up the cheese and lettuce"? And as for the wife's sandwich, "with everything here" will end up quite the goopy mess, since that'd be an order to slap on a good shot of every dressing they have. I prefer to eat my sandwiches, not suck them up with a straw. You can't just pick a set of default condiments for a sandwich. If that was the case, then you'd just be McDonalds serving 3 lousy variants of the same recycled deep fryer scrapings. If the defaults include black olives, and the client hates those, BZZT, sorry, that's a refund/exchange. People have enough trouble figuring out what they want on their lunch. Forcing them to read through a long list of defaults so they can explicitly exclude what they don't want is another client going across the street to Quizno's, where you don't have to deal with such a hassle.
Unless you can explicitly nail down the grammar of this sandwich ordering language, you can't be sure of how the machine will parse it. In other words, you've got to solve the problem of how to parse English properly. Once you get that done, then parsing a sandwichwill become "how do I guess what's on the client's mind?"
with that, I'm off to the patent office. I've just come up with an idea for Sandwich Ordering and Purchasing Markup Language. I'll call it SOaPML... (The little 'a' makes it different from SOAP, you see). I'll team with Visa to embed your sandwich build on a touchless payment card. They swing it by a scanner coming in the door, and by the time they reach the till, it's all done... unless some tasteless yutz wants to pay with cash and holds up the whole process.
-- Never play leapfrog with a unicorn
|
|
-
-
tster


- Joined on 04-11-2006
- Natick, MA
- Posts 1,765
|
Re: Speed Challenge 36: How to order a sandwich
JvdL:This is not as difficult as it seems. There is only one action a sandwich artist can do: make a sandwich. It is not an AI that needs to understand natural language, just extract a list of predefined items from a sentence. For this, it needs to find words that match a predefined list of bread types, flavors (meats and cheeses) and condiments; including words like "everything". Secondly, it needs to understand cardinals (a, one, two, ..), ordinals (first, second, "first one", ..) and negations (no, not, without, ...)
For sake of arguments, let's define following word categories (the first one being default)
- bread-type = (rye,six-inch,...)
- flavors = (chicken,turkey,cheese,...)
- condiments = (mayo,tomatoes,jalopenos,pickles,...)
In a first pass, split the sentence in phrases (using interpunction separators) and remove noise (anything that's not a predefined word, cardinal, ordinal or negation), like thus:
Good Morning! I get a six-inch turkey sandwich with no tomatoes or jalopenos. Oh, my daughter wants one too but with no pickles instead. And make one with everything for my wife here.
| Good Morning |
- |
| I get a six-inch turkey sandwich with no tomatoes or jalopenos |
[1] six-inch turkey [no] tomatoes jalopenos |
| Oh |
- |
| my daughter wants one too but with no pickles instead |
[1] [no] pickles |
| And make one with everything for my wife here |
[1] everything |
I want three sandwiches, with everything on them, and no pickles on the first one, no tomatoes or jalopenos on the second, and everything on the third. No, wait. Make that the second. Okay?
| I want three sandwiches |
[3] |
| with everything on them |
everything |
| and no pickles on the first one |
[no] pickles [#1] |
| no tomatos or jalopenos on the second |
[no] tomatoes jalopenos [#2] |
| and everything on the third |
everything [#3] |
| No |
[no] |
| wait |
- |
| Make that the second |
[#2] |
| Okay |
- |
Now apply some simple rules of thumb like this:
- categories (bread type, flavors, condiments) apply to all following until an item from that category occurs
- in absence of an explicit bread type or flavors, use default
- in absence of an explicit bread condiment, use all
- negation applies to what follows in the same phrase
- ordinals applies to entire phrase
- cardinal starts new sandwiches
- "everything" stands for all condiments
- more rules of thumb based on other test input...
- skip anything that doesn't conform to a rule.
The two sample phrase now boil down to this
| [1] six-inch turkey [no] tomatoes jalopenos |
[1] (six-inch) (turkey) (mayo,pickles) |
| [1] [no] pickles |
[1] (six-inch) (turkey) (mayo,tomatoes,jalopenos) |
| [1] everything |
[1] (six-inch) (turkey) (mayo,tomatoes,jalopenos,pickles) |
| [3] everything |
[3] (rye) (turkey) (mayo,tomatoes,jalopenos,pickles) |
| [#1] [no] pickles |
[#1] (rye) (turkey) (mayo,tomatoes,jalopenos) |
| [#2] [no] tomatoes jalopenos |
[#2] (rye) (turkey) (mayo,pickles) |
| [#3] everything |
[#3] (rye) (turkey) (mayo,tomatoes,jalopenos,pickles) |
| [no] |
- |
| [#2] |
- |
This seems to be adequate for the given input, except for the phrase No, wait. Make that the second, which frankly I don't quite understand what that is supposed to mean anyways. Granted, to fine tune this for a large amount of test input requires iterative improvements of the rules, which takes time but is not extremely difficult.
You obviously don't know how people order food. Consider: I'll take a broodwich with no onions, and my wife will have a cheeseburger. Can I get extra pickles on mine too? Oh, I almost forgot, she would not have been happy, could you put some BBQ sauce on her burger. Using your magical parser we get: a broodwich no onions a cheeseburger extra pickles not BBQ sauce burger. This looks to me like: 1. broodwich, no onions 2. cheeseburger, extra pickles, no BBQ.
The pig go. Go is to the fountain. The pig put foot. Grunt. Foot in what? ketchup. The dove fly. Fly is in sky. The dove drop something. The something on the pig. The pig disgusting... see bio for the earth shattering ending.
|
|
-
-
dhromed


- Joined on 04-13-2005
- Dutchland
- Posts 3,736
|
Re: Speed Challenge 36: How to order a sandwich
tster: You obviously don't know how people order food. Consider: I'll take a broodwich with no onions, and my wife will have a cheeseburger. Can I get extra pickles on mine too? Oh, I almost forgot, she would not have been happy, could you put some BBQ sauce on her burger. Using your magical parser we get: a broodwich no onions a cheeseburger extra pickles not BBQ sauce burger. This looks to me like: 1. broodwich, no onions 2. cheeseburger, extra pickles, no BBQ.
So you need to parse by sentence, keep a list of requested whole objects, and undestand reference words to them ("mine", "wife", "her"). Then it would spiral out of control and self-destruct. It would give people burgers with bread in between and onions underneath.
— Flurp.
|
|
-
-
Nazlfrag


- Joined on 08-05-2007
- Posts 2
|
Re: Speed Challenge 36: How to order a sandwich
Will this be the end of the Speed Challenge? Not a chance! We'll bang together a sandwich artist neural net to rival the Terminator! Either that, or just regret that winning this test would pretty much involve winning the Turing test which isn't infeasible but will result in the annihilation of mankind at the hands of the Machine Overlords.
|
|
-
-
Emyr


- Joined on 02-09-2007
- Cardiff
- Posts 42
|
Re: Speed Challenge 36: How to order a sandwich
How about a sign which says "If you like your sandwich just so one at a time is the way to go"
I'm a barman, at least we have some well known conventions when it comes to bar protocol (well, of sorts).
|
|
-
-
Emyr


- Joined on 02-09-2007
- Cardiff
- Posts 42
|
Re: Speed Challenge 36: How to order a sandwich
Opologies for the necromancy btw
|
|
-
-
PJH


- Joined on 02-14-2007
- Newcastle, UK
- Posts 1,253
|
Re: Speed Challenge 36: How to order a sandwich
Emyr:I'm a barman, at least we have some well known conventions when it comes to bar protocol
Like if there's a Guinness in the order, you ask for it last, after the other drinks have been/are being poured?
Abstinence makes the Church grow fondlers.
- unknown
|
|
-
-
Emyr


- Joined on 02-09-2007
- Cardiff
- Posts 42
|
Re: Speed Challenge 36: How to order a sandwich
Precisely, it's the one opportunity you have to get away with an unofficial breather. ;-)
|
|
-
Page 1 of 1 (20 items)
|
|
|