Notes on computational linguistics.pdf - UCLA Department of ...
Notes on computational linguistics.pdf - UCLA Department of ...
Notes on computational linguistics.pdf - UCLA Department of ...
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Stabler - Lx 185/209 2003<br />
8.1.1 Corpus studies and first results<br />
We first show how standard (freely distributed) gnu text utilities can be used to edit, sort and count things.<br />
(These utilities are standardly provided in linux and unix implementati<strong>on</strong>s. In ms-windows systems, you can<br />
get them with cygwin. In mac-osX systems, you can get them with fink.)<br />
(5) Jane Austen’s Persuasi<strong>on</strong>:<br />
1%dir persu11.txt<br />
460 -rw-r--r-- 1 es users 467137 Apr 30 18:00 persu11.txt<br />
2%wc -l persu11.txt<br />
8466 persu11.txt<br />
3%wc -w persu11.txt<br />
83309 persu11.txt<br />
4%more persu11.txt<br />
Persuasi<strong>on</strong> by Jane Austen<br />
Chapter 1<br />
Sir Walter Elliot, <strong>of</strong> Kellynch Hall, in Somersetshire, was a man who,<br />
for his own amusement, never took up any book but the Bar<strong>on</strong>etage;<br />
there he found occupati<strong>on</strong> for an idle hour, and c<strong>on</strong>solati<strong>on</strong> in a<br />
distressed <strong>on</strong>e; there his faculties were roused into admirati<strong>on</strong> and<br />
respect, by c<strong>on</strong>templating the limited remnant <strong>of</strong> the earliest patents;<br />
there any unwelcome sensati<strong>on</strong>s, arising from domestic affairs<br />
changed naturally into pity and c<strong>on</strong>tempt as he turned over<br />
the almost endless creati<strong>on</strong>s <strong>of</strong> the last century; and there,<br />
if every other leaf were powerless, he could read his own history<br />
with an interest which never failed. This was the page at which<br />
the favorite volume always opened:<br />
"ELLIOT OF KELLYNCH HALL.<br />
"Walter Elliot, born March 1, 1760, married, July 15, 1784, Elizabeth,<br />
daughter <strong>of</strong> James Stevens<strong>on</strong>, Esq. <strong>of</strong> South Park, in the county <strong>of</strong><br />
Gloucester, by which lady (who died 1800) he has issue Elizabeth,<br />
q<br />
In 1%, we get the number <strong>of</strong> bytes in the file.<br />
In 2%, we get the number <strong>of</strong> lines in the file.<br />
In 3%, we get the number <strong>of</strong> “words” – character sequences surrounded by spaces or newlines.<br />
(6) HereweusetheGnuversi<strong>on</strong><strong>of</strong>tr. Check your man pages if your tr does not work the same way.<br />
4%tr ’ ’ ’\012’ < persu11.txt > persu11.wds<br />
6%more persu11.wds<br />
Persuasi<strong>on</strong><br />
by<br />
Jane<br />
Austen<br />
Chapter<br />
1<br />
Sir<br />
Walter<br />
Elliot,<br />
<strong>of</strong><br />
Kellynch<br />
Hall,<br />
in<br />
Somersetshire,<br />
was<br />
a<br />
man<br />
who,<br />
for<br />
(7) 7%tr -sc ’A-Za-z’ ’\012’ < persu11.txt > persu11.wds<br />
8%more persu11.wds<br />
Persuasi<strong>on</strong><br />
by<br />
Jane<br />
Austen<br />
Chapter<br />
Sir<br />
Walter<br />
Elliot<br />
<strong>of</strong><br />
Kellynch<br />
Hall<br />
in<br />
Somersetshire<br />
was<br />
a<br />
man<br />
118