Live data from Hacker News

Generating code from natural language is closer than you think

blog.stephenwolfram.com

21–30 of 83 posts

Re: Generating code from natural language is closer than you think

#21

I would be fascinated to see several hundred years down the road how natural languages and computer languages have comingled and evolved into something new. I'd be inclined to believe that bringing natural language to computers won't just be a one-way street. You already see this in places like hacker news here where people often use constructs like "s/thing/other thing/" because it's more concise and useful than wri…

This is comes up in Charles Stross's novel "Accelerando." He imagines a relatively near future where children grow up speaking partially synthetic languages. It's one of my favorite novels; you can read it online, too: http://www.antipope.org/charlie/blog-static/fiction/accelera...

Stross is also an occasional commenter here on HN.

Re: Generating code from natural language is closer than you think

#22
post #8

This is in the class of "demoware", projects that are easy to program fancy demos for but are very difficult to bring to production status. (See also: "fully visual programming".) It's only really interesting if they escape from that. We'll have to wait and see.

There is a difference between visual programming and natural language. Natural languages already have tokens, syntax, and grammar whereas visual fields do not have them. All those elements must be imposed onto a visual language before it can be translated into the machine language (e.g. there is no obvious convention for visual commands or visual conditionals).

there is no obvious convention for visual commands or visual conditionals

I don't know about that. Within a particular domain, you can certainly come close to representing these things, or presenting the right controls for a user to represent commands and conditionals. For an example, check out QuickFuse http://quickfuseapps.com

Before we built this, we thought about common ways people "drew" voice apps, and commands and conditionals both have certain natural visual representations in the "voice app" space, e.g., blocks with branching arrows and writing text to indicate spoken words.

Re: Generating code from natural language is closer than you think

#23
post #14

Earlier quoted context omitted.

"Draw a red circle" is enough to get a red circle. Basic, C++, or Javascript just aren't that closely coupled with the way we think. The advantage of natural language over a high level programming language would appear to be analogous to that which a high level programming language has over assembly. I think you may be conflating programming with software development. People still develop software in assembly languag…

> "Draw a red circle" is enough to get a red circle. Yes, but once you have to say "Draw a circle in this shade of red, give it a black border this thick, make it this big and put it at these coordinates" things are starting to get unwieldy. After a few different circles I'd probably start longing for draw_circle(fill_colour, radius, (x,y,z), border_colour, border_width). Edit: Added function arguments to make the co…

> '"Draw a circle in this shade of red, give it a black border this thick, make it this big and put it at these coordinates"'

Draw a 300 pixel DarkRed circle with a thin black border centered in the blue square.

Wolfram's point is that conventional languages won't get your circle to that location as easily, e.g. if the blue square is named arbitrarily and its color is bluish but not literally blue.

I'm not suggesting that high-level languages aren't useful, but the reason people often storyboard designs with felt-tips and tracing paper rather than Photoshop is to avoid interrupting the flow of thoughts with the task of translation.

Re: Generating code from natural language is closer than you think

#24
post #22

Earlier quoted context omitted.

There is a difference between visual programming and natural language. Natural languages already have tokens, syntax, and grammar whereas visual fields do not have them. All those elements must be imposed onto a visual language before it can be translated into the machine language (e.g. there is no obvious convention for visual commands or visual conditionals).

there is no obvious convention for visual commands or visual conditionals I don't know about that. Within a particular domain, you can certainly come close to representing these things, or presenting the right controls for a user to represent commands and conditionals. For an example, check out QuickFuse http://quickfuseapps.com Before we built this, we thought about common ways people "drew" voice apps, and commands…

The convention is arbitrary (e.g. most people don't have receivers on their phones and hanging up is done by pressing down a button not by placing the receiver in a horizontal position).

If there were an obvious visual convention, the start button would not need to say "start" and the hang up button would not need to say "hang up."

That's not to say that arbitrary visual conventions can't have great utility (the alphabet being a case in point). But to illustrate the issues with graphic conventions, Quickfuse does not use the long established conventions for flowcharting. It uses natural language instead.

Re: Generating code from natural language is closer than you think

#25
First off, did he really have to plug ANKS? Honestly it seems like every piece of writing I come across from him he has to mention it.

Secondly, I think eventually programming will have to become more mainstream. And this will be done through some form of a natural language interface. Programming is best a tool to solve problems. It's way too limited now where only an elite group gets to control its use.

Eventually programming will have to become a tool as common as mathematics. The problems we face are only going to continue to grow in complexity where the only way to get a handle on them is through automated computation. The user will need the instant, iterative feedback that only a self-made program can provide. For this to happen, the interface to programming will need a radical change.

Re: Generating code from natural language is closer than you think

#26
post #9

While it would be neat to give the power of programming to everyone, I'm not convinced coding in a natural language would necessarily be better/easier than writing code in Ruby or Lisp or Python. Sure, you eliminate the first big hurdle in programming, but learning the syntax of programming language is usually one of the easier parts of software development.

"Draw a red circle" is enough to get a red circle. Basic, C++, or Javascript just aren't that closely coupled with the way we think. The advantage of natural language over a high level programming language would appear to be analogous to that which a high level programming language has over assembly. I think you may be conflating programming with software development. People still develop software in assembly languag…

This reminds of me of QBASIC (oh the nostalgia):

    CLS
    SCREEN 12
    CIRCLE (200, 300), 50, 4

Re: Generating code from natural language is closer than you think

#27
post #15

Earlier quoted context omitted.

"Draw a red circle" is enough to get a red circle. Basic, C++, or Javascript just aren't that closely coupled with the way we think. The advantage of natural language over a high level programming language would appear to be analogous to that which a high level programming language has over assembly. I think you may be conflating programming with software development. People still develop software in assembly languag…

Where is the red circle drawn? How large is it? What shade of red? How are those arbitrary values chosen, and how do I choose others? The inherent problem with NLP is that human languages are imprecise and ambiguous. For an example of the problems with NLP, try using Wolfram Alpha. While it returns useful results for many queries, as soon as you start off the beaten path it can become an exercise in frustration as yo…

> "Where is the red circle drawn? How large is it? What shade of red? How are those arbitrary values chosen, and how do I choose others?"

When those things matter, more information will be required in both natural language and a high level programming language. On the other hand, when none of that really matters a high level programming language still requires all those items to be specified.

Like any level of abstraction, there are tradeoffs. On the other hand to explain how to submit a reply, I don't say:

   
     
     
     

I say "press the button."

edit: html example to fit natural language model.

Re: Generating code from natural language is closer than you think

#28
post #14

Earlier quoted context omitted.

"Draw a red circle" is enough to get a red circle. Basic, C++, or Javascript just aren't that closely coupled with the way we think. The advantage of natural language over a high level programming language would appear to be analogous to that which a high level programming language has over assembly. I think you may be conflating programming with software development. People still develop software in assembly languag…

> "Draw a red circle" is enough to get a red circle. Yes, but once you have to say "Draw a circle in this shade of red, give it a black border this thick, make it this big and put it at these coordinates" things are starting to get unwieldy. After a few different circles I'd probably start longing for draw_circle(fill_colour, radius, (x,y,z), border_colour, border_width). Edit: Added function arguments to make the co…

The problem with computer languages is that, if you want to do something new in a language you're just learning, you don't know if it's:

draw_circle(...)

circle_draw(...)

circle.draw(...)

Graphics::circle.draw(...)

shape_draw('circle',...)

or any of the million ways to ask the computer to draw a circle.

and you don't know if you need to do:

import graphics.package

#include

use graphics.io

...

Just witness the myriad ways there are to tell the computer to print some text to standard out (echo, print, write, cout, ...), and the myriad ways to formulate a conditional or a for loop (e.g. see http://rosettacode.org/wiki/99_Bottles_of_Beer)

If the compiler/interpreter had at least some level of intelligence we could just say "draw a circle" or "output this text" and the compiler/interpreter would know which function to call, which libraries to include, and the exact syntax to use.

EDIT: Though, now that I think about it, this may be a great add-on to IDE's or text editors like Emacs, instead of having the compiler deal with it. Emacs knows which programming mode you are in, and you could just type 'M-x code: draw circle' and it inserts the appropriate code, depending on the language.

Re: Generating code from natural language is closer than you think

#29
post #15

Earlier quoted context omitted.

"Draw a red circle" is enough to get a red circle. Basic, C++, or Javascript just aren't that closely coupled with the way we think. The advantage of natural language over a high level programming language would appear to be analogous to that which a high level programming language has over assembly. I think you may be conflating programming with software development. People still develop software in assembly languag…

Where is the red circle drawn? How large is it? What shade of red? How are those arbitrary values chosen, and how do I choose others? The inherent problem with NLP is that human languages are imprecise and ambiguous. For an example of the problems with NLP, try using Wolfram Alpha. While it returns useful results for many queries, as soon as you start off the beaten path it can become an exercise in frustration as yo…

  Draw a circle.

  Color it red.

  Make it smaller.

  No, 5% bigger.

  Make the radius 5 units.
Refining specifications like that seems like the holy grail of movements like aspect-oriented programming, NLP or no. Separating concerns is a really good thing.

Re: Generating code from natural language is closer than you think

#30
post #21

I would be fascinated to see several hundred years down the road how natural languages and computer languages have comingled and evolved into something new. I'd be inclined to believe that bringing natural language to computers won't just be a one-way street. You already see this in places like hacker news here where people often use constructs like "s/thing/other thing/" because it's more concise and useful than wri…

This is comes up in Charles Stross's novel "Accelerando." He imagines a relatively near future where children grow up speaking partially synthetic languages. It's one of my favorite novels; you can read it online, too: http://www.antipope.org/charlie/blog-static/fiction/accelera... Stross is also an occasional commenter here on HN.

Crazy and hilarious to think Twitter didn't exist then, and the only web 2.0 term to make it in was 'blog'.
Post reply on HN