[Tutor] Learning natural language processing and Python? [why NLP?]

Stephen Harris cyberdiction@hotmail.com
Fri, 20 Sep 2002 10:21:29 -0700


This is a multi-part message in MIME format.

------=_NextPart_000_0019_01C2608F.7C3C1F60
Content-Type: text/plain;
	charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

Hello,

Along the lines of searching the tutor archives I found
Norvig's project and he is asking for volunteers.

AIMA PYTHON CODE
This file gives an overview of the Python code for the algorithms in the =
textbook=20
AI: A Modern Approach. The code is Copyright (c) 2002 by Peter Norvig =
and=20
is offered free of charge for your use. As you may know, the textbook =
presents=20
algorithms in pseudo-code format; as a supplement we provide this Python =
code=20
as well as Lisp code. The intent is to implement all the algorithms in =
both languages,=20
so that you can choose whichever language you prefer. As yet neither =
implementation=20
is complete, but the Lisp version is closer.=20


So I downloaded the files and below is the very start of the nlp.py =
code. The copyright=20
for the code is very open. The book is done and will be published in DEC =
2002.

"""Will be a chartparser and related NLP tools.  Not at all working yet. =
(Chapter 22)"""

from utils import *
import random, search

# [Fig. 22.4] Naive-Communicating-Agent

#________________________________________________________________________=
______
# Grammars and Lexicons

def Rules(**rules):=20
    """Create a dictionary mapping symbols to alternatives."""
    for k in rules.keys():
        rules[k] =3D [alt.strip().split(' ') for alt in =
rules[k].split('|')]
    return rules

Norvig:
"If you'd like to contribute to this project, we could really use the =
help. Read the=20
guidelines and then let me know what you'd like to contribute."=20
http://www.norvig.com/python/guidelines.html
Norvig wrote:
We already have a body of existing Lisp code; why do we need a Python =
version=20
(especially when the Lisp version is not yet complete)? Several reasons: =
....

Of all the established languages in the world, Python is closest to the=20
pseudo-code that we developed (independently) for the book.=20

SH: Anyway, at the least I think this will provide an example of Python =
nlp code.

Best regards,
Stephen


------=_NextPart_000_0019_01C2608F.7C3C1F60
Content-Type: text/html;
	charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dwindows-1252">
<META content=3D"MSHTML 5.50.4134.600" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hello,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Along the lines of searching the tutor =
archives I=20
found</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Norvig's project and he is asking for=20
volunteers.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>AIMA PYTHON CODE</FONT></DIV>
<DIV>This file gives an overview of the Python code for the algorithms =
in the=20
textbook </DIV>
<DIV><A href=3D"http://www.cs.berkeley.edu/~russell/aima.html">AI: A =
Modern=20
Approach</A>. The code is Copyright (c) 2002 by <A=20
href=3D"http://www.norvig.com/">Peter Norvig</A> and </DIV>
<DIV>is offered free of charge <A =
href=3D"http://www.norvig.com/license.html">for=20
your use</A>. As you may know, the textbook presents </DIV>
<DIV>algorithms in pseudo-code format; as a supplement we provide this =
Python=20
code </DIV>
<DIV>as well as <A=20
href=3D"http://www.cs.berkeley.edu/~russell/code/doc/overview.html">Lisp =
code</A>.=20
The intent is to implement all the algorithms in both languages, </DIV>
<DIV>so that you can choose whichever language you prefer. As yet =
neither=20
implementation </DIV>
<DIV>is complete, but the Lisp version is closer. </DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>So I downloaded the files and below is =
the very=20
start of the nlp.py code. </FONT><FONT face=3DArial size=3D2>The =
copyright=20
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>for the code is very open. The book is =
done and=20
will be published in DEC 2002.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>"""Will be a chartparser and related =
NLP=20
tools.&nbsp; Not at all working yet. (Chapter 22)"""</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>from utils import *<BR>import random,=20
search</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2># [Fig. 22.4]=20
Naive-Communicating-Agent</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial=20
size=3D2>#_______________________________________________________________=
_______________<BR>#=20
Grammars and Lexicons</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>def Rules(**rules): =
<BR>&nbsp;&nbsp;&nbsp;=20
"""Create a dictionary mapping symbols to =
alternatives."""<BR>&nbsp;&nbsp;&nbsp;=20
for k in rules.keys():<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
rules[k] =3D=20
[alt.strip().split(' ') for alt in =
rules[k].split('|')]<BR>&nbsp;&nbsp;&nbsp;=20
return rules</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Norvig:</FONT></DIV>
<DIV>"If you'd like to contribute to this project, we could really use =
the help.=20
Read the </DIV>
<DIV><A =
href=3D"http://www.norvig.com/python/guidelines.html">guidelines</A> and =

then <A href=3D"mailto:peter@norvig.com">let me know</A> what you'd like =
to=20
contribute." </DIV>
<DIV><FONT face=3DArial size=3D2>
<DIV><FONT face=3DArial size=3D2><A=20
href=3D"http://www.norvig.com/python/guidelines.html">http://www.norvig.c=
om/python/guidelines.html</A></FONT></DIV></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Norvig wrote:</FONT></DIV>
<DIV>We already have a body of <A=20
href=3D"http://www.cs.berkeley.edu/~russell/code/doc/overview.html">exist=
ing Lisp=20
code</A>; why do we need a Python version </DIV>
<DIV>(especially when the Lisp version is not yet complete)? Several =
reasons:=20
....</DIV>
<DIV>&nbsp;</DIV>
<DIV>Of all the established languages in the world, Python is closest to =
the=20
</DIV>
<DIV>pseudo-code that we developed (independently) for the book. </DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>SH: Anyway, at the least I think this =
will provide=20
an example of Python nlp code.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Best regards,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Stephen</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_0019_01C2608F.7C3C1F60--