+ All Categories
Home > Documents > Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; •...

Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; •...

Date post: 08-Sep-2020
Category:
Upload: others
View: 5 times
Download: 0 times
Share this document with a friend
75
Perl for Linguists Michael Hammond University of Arizona
Transcript
Page 1: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Perl for LinguistsMichael Hammond

University of Arizona

Page 2: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Perl for linguists

Page 3: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Perl for linguists

• Why programming?

Page 4: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Perl for linguists

• Why programming?• Why Perl?

Page 5: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Perl for linguists

• Why programming?• Why Perl?• A current Perl project

Page 6: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Why programming?

Page 7: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Why programming?

• Collect data

Page 8: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Why programming?

• Collect data• Analyze data

Page 9: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Why programming?

• Collect data• Analyze data• Remote computing

Page 10: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Why programming?

• Collect data• Analyze data• Remote computing• Model theory

Page 11: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Why programming?

• Collect data• Analyze data• Remote computing• Model theory• General professional skills

Page 12: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Code

All the code for this presentation is available overthe web (zipped) at the following URL:

http://linguistics.arizona.edu/~hammond/taiwan.html

Page 13: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Collecting data

Page 14: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Collecting data

• Running experiments locally (expprog.pl)

Page 15: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Collecting data

• Running experiments locally (expprog.pl)• Running experiments locally with a GUI

(tkexp.pl)

Page 16: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Collecting data

• Running experiments locally (expprog.pl)• Running experiments locally with a GUI

(tkexp.pl)• Assembling corpora from local static

resources (makecorpus.pl)

Page 17: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Analyzing data

Page 18: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Analyzing data

• Looking for patterns (visgrep.pl)

Page 19: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Analyzing data

• Looking for patterns (visgrep.pl)• Counting things (neightk.pl)

Page 20: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Analyzing data

• Looking for patterns (visgrep.pl)• Counting things (neightk.pl)• Finding verbs (verbs.pl)

Page 22: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Remote computing

• Running experiments remotely(Bailey & Hahn replication, bhrep.cgi)

Page 23: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Remote computing

• Running experiments remotely(Bailey & Hahn replication, bhrep.cgi)

• Interacting with local or remote databases(generating sql: dbiex.pl)

Page 24: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Remote computing

• Running experiments remotely(Bailey & Hahn replication, bhrep.cgi)

• Interacting with local or remote databases(generating sql: dbiex.pl)

• Assembling corpora from the web(websearch.pl)

Page 26: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Modeling theory

• Optimality Theory (web interface,sylpars.pl)

Page 27: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Modeling theory

• Optimality Theory (web interface,sylpars.pl)

• N-gram models (a bunch of examples from acourse on Statistical NLP that I did recently)

Page 28: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

General professional skills

Page 29: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

General professional skills

• General programming skills

Page 30: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

General professional skills

• General programming skills• Web programming

Page 36: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Why Perl?

• Free• Multi-platform• Easy• Multiple dialects• Powerful regular expression tools

Page 37: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Why Perl?

• Free• Multi-platform• Easy• Multiple dialects• Powerful regular expression tools• Written by a “linguist”

Page 38: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Why Perl?

• Free• Multi-platform• Easy• Multiple dialects• Powerful regular expression tools• Written by a “linguist”• Perl poetry

Page 39: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Why Perl?

• Free• Multi-platform• Easy• Multiple dialects• Powerful regular expression tools• Written by a “linguist”• Perl poetry• Obfuscated perl, “japhs”, etc.

Page 40: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Where to find out more

Page 41: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Where to find out more

• In any perl implementation the perldoccommand can be used to find out lots andlots of stuff.

Page 42: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Where to find out more

• In any perl implementation the perldoccommand can be used to find out lots andlots of stuff.

• The official and best perl website iswww.cpan.org, but see also www.perl.org.

Page 43: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Where to find out more

• In any perl implementation the perldoccommand can be used to find out lots andlots of stuff.

• The official and best perl website iswww.cpan.org, but see also www.perl.org.

• ActiveState Perl (a free Windowsimplementation that I use) comes withextensive web-based documentation.

Page 44: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

A current project

Page 45: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

A current project

• “Experimental Syntax Server” (with WayneCowart, James Myers, and Keith Alcott)

Page 46: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

A current project

• “Experimental Syntax Server” (with WayneCowart, James Myers, and Keith Alcott)

• Goal: to allow researchers to design,construct, run, and analyze simpleexperiments over the web.

Page 47: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

A current project

• “Experimental Syntax Server” (with WayneCowart, James Myers, and Keith Alcott)

• Goal: to allow researchers to design,construct, run, and analyze simpleexperiments over the web.

• Today: a very simple outline of how such asystem might work.

Page 48: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

General logic of project

Page 49: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

General logic of project

• Perl program running on a internet-accessibleserver.

Page 50: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

General logic of project

• Perl program running on a internet-accessibleserver.

• Users interact via web-based forms.

Page 51: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

General logic of project

• Perl program running on a internet-accessibleserver.

• Users interact via web-based forms.• Program allows for experiments to be

constructed, run, and have the resultsanalyzed.

Page 52: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

General logic of project

• Perl program running on a internet-accessibleserver.

• Users interact via web-based forms.• Program allows for experiments to be

constructed, run, and have the resultsanalyzed.

• The construction and analysis functions makeuse of a graphical user interface and aresimple enough for the naive user.

Page 53: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Some preliminary snapshots

Page 54: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Some preliminary snapshots

• Login screen

Page 55: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Some preliminary snapshots

• Login screen• Not a registered user

Page 56: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Some preliminary snapshots

• Login screen• Not a registered user• A registered user

Page 57: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Some preliminary snapshots

• Login screen• Not a registered user• A registered user• Choose a task

Page 58: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Some preliminary snapshots

• Login screen• Not a registered user• A registered user• Choose a task• Not yet implemented

Page 59: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Some preliminary snapshots

• Login screen• Not a registered user• A registered user• Choose a task• Not yet implemented• Current experiments

Page 60: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Some preliminary snapshots

• Login screen• Not a registered user• A registered user• Choose a task• Not yet implemented• Current experiments• A sample experiment

Page 61: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

The big picture

userwebbrowser

-

serverwebserver

CGI program -

�other server

MySQL

Page 62: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

MySQL database

Page 63: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

MySQL database

• MySQL is a particular open-source databaseserver.

Page 64: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

MySQL database

• MySQL is a particular open-source databaseserver.

• For the ESS project, it holds the followingdata:

Page 65: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

MySQL database

• MySQL is a particular open-source databaseserver.

• For the ESS project, it holds the followingdata:

• Users and passwords• Experiments• Experimental items• Results from individual experimental runs

Page 66: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Programming challenges for ESSproject

Page 67: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Programming challenges for ESSproject

• The program runs on a separate machine.

Page 68: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Programming challenges for ESSproject

• The program runs on a separate machine.• The program makes use of several special

perl modules:• CGI.pm: interact with the user;• DBI.pm: interact with MySQL.

Page 69: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Programming challenges for ESSproject

• The program runs on a separate machine.• The program makes use of several special

perl modules:• CGI.pm: interact with the user;• DBI.pm: interact with MySQL.

• The program includes bits in HTML to createweb pages.

Page 70: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Programming challenges for ESSproject

• The program runs on a separate machine.• The program makes use of several special

perl modules:• CGI.pm: interact with the user;• DBI.pm: interact with MySQL.

• The program includes bits in HTML to createweb pages.

• The program includes bits in SQL to talk to thedatabase server.

Page 71: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Conclusions

Page 72: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Conclusions

1. Why programming

Page 73: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Conclusions

1. Why programming

2. Why perl

Page 74: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Conclusions

1. Why programming

2. Why perl

3. Where to find out more

Page 75: Perl for Linguists - University of Arizonaperl modules: • CGI.pm: interact with the user; • DBI.pm: interact with MySQL. • The program includes bits in HTMLto create web pages.

Conclusions

1. Why programming

2. Why perl

3. Where to find out more

4. “Experimental Syntax Server” prototype


Recommended