News for hackers. Stuff that matters.
Re:Linguistics and Programming Languages by AnimalMuppet on Monday July 17, 2017 @03:22PM (#14791554)
I think Perl is interesting here.

When we're talking about computer code, we humans say things like "Read in a line of text. If it ends in a newline, remove it." But we can't program computers that way. The compiler says, in effect, "Read in a line of text from where? And put it where? If it ends in a newline? If what ends in a newline?" And so on.

But Perl actually lets you program that way. Perl says, "Read in a line of text? You didn't say from where, so I'll assume the default place, which is the files that were named as arguments in the program invocation. You didn't say where to put it, so I'll put it in the default variable. If it ends in a newline? You didn't say if what ends in a newline, so I'll assume that you're talking about the default variable, which happens to contain the line we just read in." And so on.

Effectively, you can use "it" in your conversation with Perl, and it will do reasonable things. This is one of the places that it shows that Perl was designed by a linguist.

Re:Linguistics and Programming Languages by schoen on Monday July 17, 2017 @06:09PM (#14792676)
By the way, an important problem in natural language processing, which is related to this at a high level, is anaphora resolution. When we use pronouns to refer to people and things we've mentioned before, there are often ambiguities about what the referent of a particular pronoun is, but native speakers almost never have to consciously think about this question. But in practice, resolving these references correctly may require sophisticated reasoning about our knowledge of the world in order to determine which interpretation is plausible.

An example adapted from the Winograd Schema Challenge is:

The file couldn't fit on the hard drive because it was too big.

The file couldn't fit on the hard drive because it was too small.

In the first sentence, "it" refers to the file; in the second sentence, "it" refers to the hard drive. Native speakers who know what files and hard drives or (or even who don't) should have no trouble understanding the references and might not even have noticed that there was any ambiguity (!), even though resolving the ambiguity requires bringing to bear specific knowledge about the world.

There is a whole family of AI language understanding problems based around this, such as

https://en.wikipedia.org/wiki/Winograd_Schema_Challenge

Looking over some examples shows just how challenging this can be, because of the way the sentences can require people to know arbitrary things about the world. ("The atom emitted a photon because it was entering a lower energy state.")

Re:Linguistics and Programming Languages by thaumasiotes on Monday July 17, 2017 @06:32PM (#14792786)
> even though resolving the ambiguity requires bringing to bear specific knowledge about the world

Actually, in this example knowledge of the world (I'm interpreting this as referring to knowing the details of how "files" and "hard drives" relate to each other) is not necessary. The ambiguity disappears as soon as you know the meaning of "fit" -- fitting requires a large thing to contain a small thing. Therefore if something is too large, it must be the contained object, and if something is too small, it must be the container, and those roles are marked directly within the syntax of the sentence.

You can easily see this experimentally by asking people about sentences with nonsense words:

1. The glirp couldn't fit on the vell because it was too small.

2. The glirp couldn't fit on the vell because it was too big.

Then again, I see you've already noted that speakers who don't know what files or hard drives are should have no trouble with these sentences. Is the lexical meaning of "fit" "knowledge about the world" to you?

Re:Linguistics and Programming Languages by gpawl on Monday July 17, 2017 @09:46PM (#14793770)
When you say "glirp couldn't fit on the vell", do you mean to say that the glirp was placed onto the veil, or that the glirp placed the vell on the glirp itself?

The melon could not fit on the hat because it was too small.

The melon could not fit on the hat because it was too big.

https://www.google.com/search?q=watermelon+hat

Re:Linguistics and Programming Languages by thaumasiotes on Monday July 17, 2017 @10:53PM (#14793967)
The first. If the glirp was trying to wear the vell, I'd say "the glirp couldn't put on the vell" or something else idiomatic, like "the glirp couldn't get the vell on". I cannot use "fit on" in the sense you're going for.

You can investigate this yourself at http://corpus.byu.edu/coca/ ; the first hundred results for "fit on" contain, by my eyeball estimate, more than 90 of the sense I describe, zero of the sense you insinuate, and a few spurious hits (such as "to spend as it sees fit on government services", "kept himself fit on a rowing machine", and my favorite, "I've worked with schools such as the Pratt Institute and FIT on developing eco-friendly vegan design programs").

There are six results, out of over 500 million words, for "fit it on", of which one matches your pattern. ("She passes it under the running tap and hikes her tank up to fit it [a strip of nylon] on around her rib cage")

Re:Linguistics and Programming Languages by schoen on Monday July 17, 2017 @06:42PM (#14792865)
That's a good point, and this might be an example of the selectional restrictions issue

https://en.wikipedia.org/wiki/Winograd_Schema_Challenge#Pitf...

or a similar kind of inference that could be considered easier than expected.

I'm not sure exactly what I would consider "knowledge about the world" in this setting. :-)

Re:Linguistics and Programming Languages by khedoros1 on Tuesday July 18, 2017 @02:31PM (#14798933)
> 1. The glirp couldn't fit on the vell because it was too small.

Situation 1: vell=table, glirp=dish. "It" refers to the vell.

Situation 2: vell=bolt, glirp=nut. "It" refers to the glirp.

Replace "on" with "in", and maybe there's less ambiguity.

Re:Linguistics and Programming Languages by throwaway7645 on Monday July 17, 2017 @05:24PM (#14792378)
Yep, default variables and context are important to Perl. I like a lot of the design, but there is a lot of cruft that has piled up in 30 years. Perl6 addresses that while adding support for FP, OO, array programming, grammar based programming...etc. I find it quite pleasant to read and write. The problem is the implementation is immature and I'm not sure it will ever be as fast as we need for a production language.
Re:Linguistics and Programming Languages by falsedan on Monday July 17, 2017 @05:58PM (#14792609)
The topic variable came from awk; most of the whipitupitude variables are direct ports of awks.
Re:Linguistics and Programming Languages by throwaway7645 on Tuesday July 18, 2017 @09:10AM (#14796227)
I completely forgot about that, good point!