Warning: Constant ABSPATH already defined, this will be an error in PHP 9 in /home/unhinder/www/www/Phi/wp-config.php on line 22

Warning: Cannot modify header information - headers already sent by (output started at /home/unhinder/www/www/Phi/wp-config.php:22) in /home/unhinder/www/www/Phi/wp-includes/rest-api/class-wp-rest-server.php on line 1930

Warning: Cannot modify header information - headers already sent by (output started at /home/unhinder/www/www/Phi/wp-config.php:22) in /home/unhinder/www/www/Phi/wp-includes/rest-api/class-wp-rest-server.php on line 1930

Warning: Cannot modify header information - headers already sent by (output started at /home/unhinder/www/www/Phi/wp-config.php:22) in /home/unhinder/www/www/Phi/wp-includes/rest-api/class-wp-rest-server.php on line 1930

Warning: Cannot modify header information - headers already sent by (output started at /home/unhinder/www/www/Phi/wp-config.php:22) in /home/unhinder/www/www/Phi/wp-includes/rest-api/class-wp-rest-server.php on line 1930

Warning: Cannot modify header information - headers already sent by (output started at /home/unhinder/www/www/Phi/wp-config.php:22) in /home/unhinder/www/www/Phi/wp-includes/rest-api/class-wp-rest-server.php on line 1930

Warning: Cannot modify header information - headers already sent by (output started at /home/unhinder/www/www/Phi/wp-config.php:22) in /home/unhinder/www/www/Phi/wp-includes/rest-api/class-wp-rest-server.php on line 1930

Warning: Undefined array key "HTTP_REFERER" in /home/unhinder/www/www/Phi/wp-content/plugins/google-hilite.php on line 58

Warning: Undefined array key "HTTP_REFERER" in /home/unhinder/www/www/Phi/wp-content/plugins/google-hilite.php on line 58

Warning: Undefined array key "HTTP_REFERER" in /home/unhinder/www/www/Phi/wp-content/plugins/google-hilite.php on line 58

Warning: Undefined array key "HTTP_REFERER" in /home/unhinder/www/www/Phi/wp-content/plugins/google-hilite.php on line 58

Warning: Undefined array key "HTTP_REFERER" in /home/unhinder/www/www/Phi/wp-content/plugins/google-hilite.php on line 58

Warning: Undefined array key "HTTP_REFERER" in /home/unhinder/www/www/Phi/wp-content/plugins/google-hilite.php on line 58

Warning: Undefined array key "HTTP_REFERER" in /home/unhinder/www/www/Phi/wp-content/plugins/google-hilite.php on line 58

Warning: Cannot modify header information - headers already sent by (output started at /home/unhinder/www/www/Phi/wp-config.php:22) in /home/unhinder/www/www/Phi/wp-includes/rest-api/class-wp-rest-server.php on line 1930

Warning: Cannot modify header information - headers already sent by (output started at /home/unhinder/www/www/Phi/wp-config.php:22) in /home/unhinder/www/www/Phi/wp-includes/rest-api/class-wp-rest-server.php on line 1930
{"id":788,"date":"2008-02-02T22:58:53","date_gmt":"2008-02-02T22:58:53","guid":{"rendered":"http:\/\/UnhinderedByTalent.com\/Phi\/archives\/2008\/02\/02\/n-grams-and-the-evolution-of-programs\/"},"modified":"2008-06-12T00:11:39","modified_gmt":"2008-06-11T23:11:39","slug":"n-grams-and-the-evolution-of-programs","status":"publish","type":"post","link":"https:\/\/UnhinderedByTalent.com\/Phi\/archives\/2008\/02\/02\/n-grams-and-the-evolution-of-programs\/","title":{"rendered":"N-grams and the evolution of programs"},"content":{"rendered":"

Which of the following was written by (a) me, (b) William Shakespeare, and (c) Charles Darwin?<\/p>\n

<\/p>\n

\u201cI would have sent to Rome that’s worthy death?\u201d<\/p><\/blockquote>\n

\n\u201cThe naturalist looking at species as he might succeed from a fork low down in the separation of the species of any species in a more or less from their sap this is unimportant for the instincts already possessed by certain plants so that natural selection of mere piles of superimposed strata and watch the sea separating an island even if we believe that pure water can effect little or no offspring.\u201d\n<\/p><\/blockquote>\n

\n\u201cThe troubling aspects of a building block semantics in a given tree in the context and false.\u201d\n<\/p><\/blockquote>\n

The answer and (much) more is below the fold.<\/p>\n

<\/p>\n

That probably wasn\u2019t too hard.<\/p>\n

Except, of course, I\u2019m a mean person and it was a trick question. In fact none of those sentences was actually written by a human being. All three of these pseudo-quotes were generated using simple statistics and the notion of N-grams<\/a> (which I will describe below) to capture and reproduce the sense<\/i> of a text, without really understanding it at a larger scale. I wrote a program to create these examples as an opening illustration for my Dagstuhl<\/a> talk, and since they\u2019re a lot of fun I thought I\u2019d summarize the key concepts here.<\/p>\n

<\/p>\n

A quick intro to N-grams<\/h3>\n

The essential idea is to look at the frequency of the occurrences of groups of adjacent symbols (called N-grams). In this example the symbols are words, and we\u2019re using N=3, so we\u2019re looking at triplets of adjacent words. The preceding sentence, for example starts with the following sequence of triplets:<\/p>\n