Bryn Mawr College
CS 325: Computational Linguistics - Fall 2024
Assignment#1
Due in class on Wednesday, September 18
Description: Write Python programs to do each of the following (there are a total of 2 programs):
First, read and work though the examples in the two Python For Linguists Tutorials from Lab#1: Part1, Part2.
1. Using regular expressions extract and print the office hours of instructor from the CS325 home page at cs.brynmawr.edu
1. Using regular expressions extract and print the office hours of instructor from the CS325 home page at cs.brynmawr.edu
2. Using regulr expressions extract and print the current weather conditions ("snow", "light snow", "rain", etc.) and temperature in Philadelphia from the NOAA's weather server. To get the URL for Philadelphia weather:
a. Go to: http://www.weather.gov/xml/current_obs/
b. Select the state (Pennsylvania) and press the "Find" button.
c. Find and click on Philadelphia International Airport.
You will get the local weather conditions in Philadelphia.
d. Right-click on the page and "View Source" to see how the page is formatted.
Next, use the URL in your program to do the exercise.
Notes
- For web page extraction: Take a look at the html-source of the web page and look for textual markers.
- For web page extraction: You will need to make generous use of regular expressions. Python's regular
expression package (re) is especially well suited for this purpose. Refer to
the tutorials posted on the main home page for this class.
- For web page extraction: This is basically a text processing task.
- Work incrementally to accomplish the task.
- Remember that in this domain, the problems generally tend to be ill-defined
and solutions also tend to be imperfect.
- This exercise is designed to help you face with the above reality and
yet explore and come up with your own solution(s) to solving the problem.
- Try and document your thought process at each step.
- Once done, write down the process by which you arrived at the final solution.
- Do the assignment in a Colab Notebook (both programs in the same Notebook) containing your well commented
program(s), and code blocks to run and display sample outputs. Try and make the outputs as clean as possible (with no extraneous text). At the end of the Notebook, write a final section on your own
reflections on the exercises, the process, and how you arrived at the solution(s).
Are your solutions general enough? For example, would it be able to extract
the same information from another similar source? What changes/modifications
would you require for another source?
- Make sure your name appears in the heading at the top of the Notebook.
WHAT TO SUBMIT
Once completed, send/share the link to your Notebook with the instructor via e-mail. To do this, click on the "Share" icon/button (see top right of window), in the pop-up window, change the access to "Anyone with link", copy the link and paste into the e-mail.
Back to CS325 home page.