Metafor: Translating Natural Language to Code 475
vivin writes "Computer programming is second nature to most of the Slashdot crowd. However, this is not true for the vast majority of people. Formal programming languages are not as expressive or flexible as natural languages. This becomes more evident when we try to translate user requirements into actual code. Researchers at MIT have come up with a program that bridges this gap. It's not so much a tool that turns English into code, as it is a program that translates requirements (in English) to code. When Metafor analyzes English, nouns phrases become objects, verbs become functions, and adjectives become object attributes (or properties). In addition to helping programmers visualize their program better, I think it also promotes writing concise (and therefore) requirements and descriptions. Metafor doesn't handle run-on sentences (or bad English) that well." Update For for the dupe. Not going well. Appreciate all the hate mail. Really encourages improvement.
Usefulness (Score:5, Insightful)
understand computers to actually write them. But it would help when someone wants to make something like a 3D scene in Blender. It reminds me a lot of that episode of STTNG (Schizims) where Riker, Troy and Worf are telling the computer to replicate an alien room that they were in.
Re:Usefulness (Score:2)
Re:Usefulness (Score:2)
Natural languages are not enough (Score:3, Insightful)
The use of special purpose languages is nothing new. They're used in mathematics, chemistry, music etc. ... pretty much anywhere where it is easier to use a special purpose language to express concepts than with a natural language. Sure there is a learning curve, but that is often the least of the hurdles in doing a reasonable job.
Take for example music: For the mu
Dupe (Score:3, Informative)
Re:Dupe (Score:5, Funny)
"Don't allow dupes."
There, now I have to decide whether it will be FOSS.
Re:Dupe (Score:5, Insightful)
Update For for the dupe. Not going well. Appreciate all the hate mail. Really encourages improvement.
Nice. Someone should go to customer service 101 and grow up a little. Yelling at the people who (indirectly) line your wallet. Not a good idea....
Re:Dupe (Score:5, Insightful)
How terribly difficult would it be to add a url checker. I can understand a dupe when its an article written differently by two publications, but a simple URL checker can state "this url was used in store XYZ [with link]," so the editor can determine if its a dupe story or just a url used in two different stories...
Re:Dupe (Score:3, Insightful)
It's actually sorta important! (Score:5, Insightful)
It's especially annoying when the dupe article proclaims that the
Re:It's actually sorta important! (Score:4, Insightful)
We don't have to beg. We can just submit a patch to slashcode.
Re:It's actually sorta important! (Score:5, Insightful)
Slashdot is not interested in applying these patches, because dupes mean more angry posts, and angry posts mean more pageloads, and more pageloads mean more ads served.
Re:It's actually sorta important! (Score:5, Interesting)
Please state your requirements about a dupe checker, between realistic boundaries.
Things like - integration into the accepting stories interface seamlessly, spamassassin style dupe detector with a point based system, or even coding bayesian algorithms - are possible.
I'm willing to (help to) code it. With two conditions. You'll apply it and use it. If this happens i'm predicting a serious decline in dupe stories and posts.
If you fail to do this or you're not interested in this offer, then STOP being pissed, put up with the hate mail, the accusations about ad revenues, and use the bloody search function.
Just to make sure this offer reaches you i'm going to mail it to you, and continue to do so - in regular periods - until i get some kind of reply, either a yay or a nay.
Yours, a beautiful mind
Re:Dupe (Score:5, Insightful)
These are paid editors who can't be bothered to read their own website. The problem is not technological, and doesn't require a technological fix.
Lazy admins (Score:4, Insightful)
Re:Dupe (Score:5, Funny)
Re:Dupe (Score:4, Funny)
I fed this text into Metafor and it core dumped on me!
Re:Dupe (Score:5, Insightful)
Is he drunk or something (For for??) At least we know he reads the hate mail, so send more. Ignoring stupid avoidable fuckups certainly doesn't work.
They can either
1) implement a simple function that compares the main words in the article with recent ones, particularly URLs (ignoring some obvious generic ones, like the home page of newspapers). (For extra credit, spellcheck the fucking thing, and check that any URLS exist.)
2)Read the mail that comes in from subscribers telling them they've duped (apparetly that's mostly ignored; when I send it in it often bounces, some editora apparently have invalid forwardnig addresses)
3)Or use their own brains and just type one relevant word into the Slashdot search box:
Search 'metafor' [slashdot.org]
Metafor: Translating Natural Language to Code
On March 30th, 2005 with 170 comments
vivin writes "Computer programming is second nature to most of the Slashdot crowd. However, this is not true for the vast majority of people. Formal...
English To Code Converter
On March 26th, 2005 with 52 comments
prostoalex writes "Metafor from MIT is a code visualization utility, capable of converting high-level descriptions into class and function (or method...
Very Cute (Score:5, Insightful)
It wasn't long before it was reul languages actually broke away from English and relied more heavily on easily-parsable, special characters to define structure. We can see the results of this in today's C/C++, Java, LISP, PERL (bleh), and Python languages. This new interface does nothing but try to perform some of the structural thinking done by the programmer. (Although I have my doubts as to its current real world ability.)
So the question that then comes to bear is, "Who would use this natural language interface?" Sadly, the answer is most likely "programmers". But why would a programmer use this interface if he has to be trained in computer logic in the first place? It would seem like an unnecessary level of abstraction that would only serve to hinder a programmer's natural abilities.
Of course, there is the documentation issue. Supposedly this interface will be useful for producing requirements in addition to code. But who produces the requirements? Not the programmer. That's usually the job of the business analyst, someone who may not even have experience with coding logic. And for code documentation, nothing quite beats the JavaDoc style documentation that has become popular in the last few years.
I think that research like this is interesting, but I doubt it will have many uses until AI and voice recognition improves to a level similar to that seen in Star Trek. Only about 300 more years and counting.
Re:Very Cute (Score:2)
It wasn't long before it was realized that programming was a structured discipline, similar in form to mathematics, and must be treated as such. Many of the more successful languages actually broke away from English and relied more heavily on easily-parsable, special characters to define structure.
Re:Very Cute (Score:4, Insightful)
Yeah that is what I was thinking. For this to be usefull, the requirements have to written in a format that mirrors programming logic. If you are not a progrmmer, you probably do not think in that kind of logic. That is why most the the requirements documents I see are incomplete and open to interpretation.
Importance of writing Good Requirements (Score:3, Insightful)
a) Help computer engineers describe their program's requirements better so others can follow them better.
b) Help beginning computer programmers make the connection between a natural language description of their program and the program itself. For example, this can help th
Re:Very Cute (Score:3, Interesting)
In working with designers (especially inexperi
Code Complete (Score:3, Funny)
Re:Very Cute (Score:4, Insightful)
Re:Very Cute (Score:5, Informative)
For what it's worth, OOP is quite easy. The first thing you need to think is data encapsulation. Data encapsulation is simply the practice of bundling related data together. i.e. Color, make, year, and model are all attributes of a car. So you'd tend to put them together. You know, like structs. For example, a game sprite might have x, y, width, height, and direction variables. Of course, we want to know what the direction stands for, so we add static constants: Now for the truly OOP part. We need a way of making the data operate on itself. For an example, I'll choose changing direction. Doesn't seem like much, but what if we want to ignore improper directions? In a real OOP program, we'd probably throw an exception, but you get the idea I hope. Now that we have our Sprite class, it can be treated as a complete data type of its own: There you have it. A five minute introduction to OOP. Hopefully this will help unblock whatever mental issue is in your way. (Or badly written books as the case may be.)
(Stupid lameness filter. Recognize code will you? No, that would be too difficult wouldn't it? Stupid lameness filter. Did I mention how stupid the lameness filter is? Recognize code will you? Stupid lameness filter. Recognize code will you? Stupid lameness filter. Recognize code will you? Stupid lameness filter. Recognize code will you? Stupid lameness filter. Recognize code will you? Stupid lameness filter. Recognize code will you? Stupid lameness filter. Recognize code will you? Stupid lameness filter. Recognize code will you?)
Re:Use enums instead (Score:3, Informative)
public class Direction
{
public static final LEFT = new Direction(1);
public static final RIGHT = new Direction(2);
public static final UP = new Direction(3);
public static final DOWN = new Direction(4);
private int dir;
private Direction(int dir)
{
this.dir = dir;
}
}
Then the changeDirection method is
public void changeDirection(Direction dir)
{
Re:Use enums instead (Score:3, Informative)
The private constructor ensures that only these 4 instances of this class will ever be instantiated.
Re:Very Cute (Score:3, Insightful)
*Shudder*
PHP4 aside, I'm not really sure what is so difficult to understand about OOP, so maybe you can help me understand the mental block some people have. Here's my five minute buildup. Let me know where it is that you had hangups.
OOP at its core is a way of designing your code so that related data and behaviors are encapsulated together. That is OOP. Period. End of story. Many languages can implement this, including JavaScript, PHP, and even C! (Amazing what one can
Re:Very Cute (Score:3, Informative)
If you don't know C, look at Python.
The OOP paradigm is much easier to get in the right language.
Use cases are deceptive (Score:3, Informative)
Its also possible to construct use cases which don't make any sense (by not requiring the holes in the floors.)
Re:Use cases are deceptive (Score:3, Insightful)
In our practice we bridge that gap through requirements and logical design. It's inelegant and I don't like it, but when you're a consulting firm sometimes it's more important to be able to say that you use industry standard practices than it is to have the absolutely ideal solution.
I can imagine... (Score:4, Funny)
int jerk_at_counter, hottie_in_accountancy, dork_at_it;
kill(boss);
send(intern,hell);
Yeah, that will work...
Re:I can imagine... (Score:2)
Great! (Score:5, Funny)
of little value here! (Score:5, Funny)
Forget it being a tool for this crowd then!
Re:of little value here! (Score:2)
The natural language interface is of little value here!
Forget it being a tool for this crowd then!
You may then forget about the natural language interface being a useful tool for the Slashdot.org crowd!
There, that should debug it.
Re:of little value here! (Score:2, Funny)
For i=1 to count(This_crowd)
i.remove(tool_from_toolkit)
next i
Stop
We're getting there....
It is coming to pass... (Score:5, Funny)
http://www.murphys-laws.com/murphy/murphy-compu
Re:It is coming to pass... (Score:2)
Bad English (Score:2, Insightful)
Because the average joe wants to be a programmer? (Score:5, Funny)
Oh, great... (Score:2, Insightful)
I'm sure we've all experimented with header files that define an english-like syntax for our code. We've dumped it for a reason - it's not as efficient.
Hiding what's going on "under the hood" is never a good thing. Good code, like good food, depends on good ingredients, and the knowledge of how to combine them.
Crap food, on the other hand, can be produced by anyone with a stove and delusions of cooking a
Re:Oh, great... (Score:3, Insightful)
Re:Oh, great... (Score:3, Funny)
Re:Oh, great... (Score:3, Insightful)
Definitely, at least when it comes to business apps.
Would you trust a surgeon who's 15 years out-of-date to operate on you?
So, would you trust someone to write code who is even a couple of years out of date? Things change rapidly in this field, dude. Us old far[tt]s remember when it was a kinder, gentler world ... but it's not like that any more.
Just like you wouldn't give a you
Extending the analogy... (Score:3, Insightful)
But not all code is written for business apps. What about scientists who understand logic fairly well, but who have difficulty in C or C++? (There are a surprising number of such people.)
Would you prevent a mother with no medical training to put a ban
It's all a matter of perspective... (Score:3, Interesting)
Sounds like someone has a case of the Mondays. ;) Seriously, you appear to be speaking from your experience as someone who has to support idiots (AKA the general population). OTOH, I'm speaking from my experience in the s
Doomed to failure (Score:5, Insightful)
Re:Doomed to failure (Score:3, Insightful)
Invariably, this is the situation where those who make the specs need to be at a higher level than those who code the project. The article is right, we don't think in C++, we think in English.
I can't wait to see what kind of new things this project brings about.
you must be new here (Score:5, Funny)
Maybe back in 1998, but haughty sniping is second nature to most of the Slashdot crowd now.
Re:you must be new here (Score:3, Funny)
Maybe so (Score:2)
Re:Maybe so (Score:2)
This story is a dupe, but (Score:4, Interesting)
One of the things that really bothers me about Linux is the pervasiveness of languages like C that make no attempt to model higher thought and instead force the developer to constantly re-learn old unusable APIs and shove ancient hacks that are unreadable just to get drivers working. Objects in code need their a[tt]ributes to mirror real-word equivalents, otherwise reading the code is impossible because no one else can make sense of all the confusing acronyms and variable names.
I actually think that .NET is the right step for us. Mono is really the first sensible language (Java doesn't count; it's not free) that has any mindshare for Linux, and let's face it the Linux world needs it. Until writing software for Linux can just be a simple translation of designs in our heads to GUI design and implementation, Linux will lag behind the rest of the world because of how long it takes to write software for it.
COBOL (Score:2)
Why I like Perl.... (Score:2)
Plus all the cool and naughty operators and functions like tie, bind, die, etc
With All Due Respect... (Score:4, Insightful)
Re:With All Due Respect... (Score:3, Funny)
You fail it.
May not work for programming, but... (Score:2)
I'll bet this work will ultimately lead to effective verbal control of computers, as in the sort of Sci-Fi situation where you might say "Computer, play KidA by Radiohead, and get me the NY Times".
Good, interesting stuff, I hope they keep working on it.
Good example (Score:2)
Indeed. "and therefore..." what?
Rules (Score:5, Interesting)
Doomed to fail? (Score:5, Interesting)
Projects promoting programming in "natural language" are intrinsically doomed to fail.
He said that 30 years ago. People still don't listen.
Re:Doomed to fail? (Score:3, Insightful)
That would have been unnecessary, given a better citation. Which portions of Dijkstra's original argument [utexas.edu] are no longer applicable?
Re:Doomed to fail? (Score:3, Interesting)
Yes, I did. The knowledge wasn't a problem, but the habits that came from using them extensively were obstacles to constructing useful abstractions. Note that I grew up with old-school BASIC. Mandatory line numbers, and GOSUB was the highest level of abstraction you cou
Bad English?!?!? (Score:3, Funny)
What's a 'metafor?' (Score:2)
Have Kylie stripped washed and brought to my tent (Score:5, Funny)
waiting...
waiting...
Stupid computer doesn't do anything I tell it
Clippy (Score:4, Funny)
"It looks like you want to strip-wash Kylie. Now readying strip-washer [bintzlerinc.com], copper surfacer, and metal shearer. Thank you for using Metafor."
I don't think so (Score:4, Funny)
Congratulations to MIT! (Score:2, Insightful)
Congratulations!!!
You've invented Smalltalk!
Welcome to 1980!
the old is new again (Score:4, Insightful)
Ah, this old thing again.
The hard part about programming isn't turning basic English text in to half-assed code. If it were, then Google have built their company on just-out-of-college scripters and Visual Basic.
[Liu says] "Many subjects immediately identified the simplistic interpretation of the interpreter, and wanted the opportunity to rephrase their original wording to fix the error."
Yes, regular English is insufficient for programming. If a tool like this becomes popular, you'll need still need a special class of people to figure out what is needed and to figure out how to phrase the desire in the precise way that makes this guy's interpreter actually do what they want.
In other words, he hasn't invented a way to eliminate programming or programmers. He's figured out a way to make a programming language that is slightly easier to learn at first. But because it's removed from what computers actually do, much harder to use for anything serious. The hard part about programming isn't the month you spend learning Java syntax, it's the many years you spend learning to write code well.
Their theory appears to be that this will make programming easier to learn. I wish them the best of luck in that goal, but having seen over the years a number of graphical and natural-language programming tools vanish without a trace, I'm not holding my breath.
Adverbs? (Score:2)
Maybe Microsoft can help (Score:2, Insightful)
The associated paper is very weak (Score:3, Informative)
This has been tried before [c2.com], not successfully.
Natural Language to Logical Code - *gasps* (Score:3, Insightful)
And it's still science fiction because:
- Language is situational, societal, and emotional
- Most people doing this sort of work communicate in English. So they assume English is a good place to start from. Unfortunately, it's one seriously illogical language to start from.
There have been attempts to create 'natural language' programming languages. And in the main they HAVE been successful. Sure, they are inefficient. But so is human communication.
Every psuedo-code compiler / interpreter that I've ever seen (since the 1970's) has simply been a programming language. Sure, maybe they're a little nicer to look at, but they will always fail the Turing test.
Want TRUE natural language programming ?
Develop a computer that works linguistically, not logically.
What about the other way around (Score:5, Insightful)
Secondly, I think that what is needed is the other way around : automated analysis of code and production of natural language reports that designers could browse more easily than the code itself looking for bugs or designing extensions and additionnal feature. They would then intervene directly on the code itself.
Sort of a souped up version of Knuth's literate programming, only with a much more radical transformation of the code for its vizualisation, bringing up the essential and critical aspects.
Think of how a reasonably complicated mathematical proof, say within the formal set theory, would look like in a math paper or book meant to be read. Compare with how it would be coded in a theorem prover. Different. Yet the former can be automatically generated from the later.
Hinderance, not a help (Score:3, Insightful)
Converting natural language to software does NOT address this problem. Natural languages are not expressive or fluent at rigiourously addressing complexity issues. Rather, formal methods address this problem; even weak formal methods such as state machines produce enourmous benefits to code quality, since they force the author to consider all possible outcomes from all function calls and at the same time, by rigiously, logically and consistently exposing the behaviour of the program, permit far easier code modification by later authors.
--
Toby
Taco has a point (Score:3, Insightful)
Unless you have an '*' next to your name, you don't pay for slashdot other than the electricity to run your box. Don't give me the "but the ads are there" tripe either. I know most of you either use Adblock or ignore them anyway.
The source is available. Start your own site.
Re:Taco has a point (Score:3, Insightful)
I don't see your '*', but a registered user and evan an AC adds traffic and credibility to the site. I don't know the numbers of subscribers, but I doubt
Update (Score:5, Funny)
Ah, yes! Duping words next to each other, that is the new fad. Because duping articles is so yesterday's news
Poor Taco (Score:5, Insightful)
I've never been one to complain about dupes. I figure I already get way more than I pay for from this site (which is zero). But if people are frustrated about dupes, maybe it's because it's an exceedingly simple problem to solve, and the Slashdot editors give every appearance of not bothering to lift a finger to solve it.
Re:Poor Taco (Score:3, Insightful)
Time flies like an arrow (Score:5, Interesting)
1) Time proceeds as quickly as an arrow proceeds.
2) Measure the speed of flies in the same way that you measure the speed of an arrow.
3) Measure the speed of flies in the same way that an arrow measures the speed of flies.
4) Measure the speed of flies that resemble an arrow.
5) Flies of a particular kind, i.e. time-flies, are fond of an arrow.
I would guess the source code for those five different interpretations would be, well, different. (The fifth one is my favorite.)
About your update, Taco (Score:5, Insightful)
Taco, you asshole, you've been duping stories for years. You've known about them and yet you've done nothing to fix the problem. Don't pull this sentimental BS about not "encouraging" improvement. If the fact that if Slashdot is your creation, and is your job, isn't enough "encouragement" for you to fix the problem of dupes, I don't think anything will be. From all appearances, it looks like you've given up on
Re:About your update, Taco (Score:5, Insightful)
Re:About your update, Taco (Score:5, Interesting)
1) pick stories to post
2) sell advertising
3) maintain the servers
4) design and implement additions, bug fixes, etc
Now, I'm not a subscriber, but I don't see much in the way of 4), even for features that the readership is crying out for, or that make financial sense for slashdot (such as moving to CSS for layout). I thought that
That seems to me to leave an awful lot of time left over for 1), picking stories to post. And yet, it seems like every day or two there is a dupe, every week or so there is a downright inaccurate (or even lying) summary or headline posted, and every month or so something that's accurately summarised, but the source is just plain made up or wrong.
I know that the FAQ states that the editors don't check the stories for factual correctness, but Taco (et al) I ask you this: what do you do all day?
Dupe checking is a not a technical problem. (Score:5, Insightful)
At LWE in January, 2001, at a conference on Slashcode, someone asked us at Newsforge how our site had so few dupes compared to Slashdot. There were two reasons:
1) We had a smaller audience of people to see the dupes we did accidently post.
2) We searched our archives before posting any story. We searched by story URL, by story keyword. We also generally skimmed the site when we weren't working to be aware of what was being posted.
Clearly, #1 is something Slashdot doesn't have working in its immediate favour, but #2 is something that shouldn't be too hard. Zonk, Timothy, Cliff, Simonker, etc, don't post dupes nearly as frequently as CmdrTaco. Hemos doesn't post often, but he also seems to be pretty dupey (understandable as he's not really associated with
The worst example is something like the PSP dupe story: Taco didn't even check out the games section, which had that story right at the top! A simple search for "PSP" and "Browser" would've shown it even if he never reads sections.
CmdrTaco doesn't read his own site. What does this tell you about how he feels about it?
I don't read Kuro5hin much anymore for the same reason. Complaining about dupes will just drive him further away, even though he still has to work on it by contract.
Re:Dupe checking is a not a technical problem. (Score:3, Interesting)
Yes, that's been pretty obvious for the last couple years.
I don't read Kuro5hin much anymore for the same reason. Complaining about dupes will just drive him further away, even though he still has to work on it by contract.
You say that like it would be a bad thing. Maybe it's time he lost the presence, admit that's he's been burned out for years, and handed over the "reigns" to someone who cares enough about Slash
Re:Dupe checking is a not a technical problem. (Score:3, Informative)
http://slashdot.org/comments.pl?sid=21076&cid=223 3 142 [slashdot.org]
http://slashdot.org/comments.pl?sid=21076&cid=2233 751 [slashdot.org]
It's kind of depressing to see that these issues keep getting rehashed year afte
Hello World in COBOL here... (Score:2)
Here [latech.edu] is the traditional "Hello World" progam in COBOL (for the youngsters out there who never had to program in it).
Only 20 lines.
Thanks a lot. (Score:2, Funny)
Why couldn't you have just left well enough alone, so I could keep happily despising it?
Next thing you know, I'll be pining away for OS/390 JCL.
Re:Hello World in COBOL here... (Score:2)
As a former COBOL-85 programmer, who still really likes the language, I have to say that the obsession with My language can do "Hello World" in only X lines is silly.
COBOL was designed for "big apps", not scripting. In a 5000 line file, the 8 lines of "comments" stating necessary stuff like program name, who wrote it and when, is only 0.16% of the line count.
Re:Hello World in COBOL here... (Score:3, Insightful)
Re:Translate this: (Score:4, Funny)
Re:Ebonics? (Score:2)
Re:Ebonics? (Score:5, Funny)
Re:Other uses? (Score:5, Interesting)
Cooking for Engineers (Score:3, Interesting)
Re:I call BS (Score:3, Insightful)
Everyone here seems to be quick to assume that the goal of a natural language like this is to be able to take the place of complex programs and what not. I see it more as a way for the average user to make on-the-fly programs for certain specific functions. The life and death stuff can come later, but for now, assuming this natural language