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

  1. For web page extraction: Take a look at the html-source of the web page and look for textual markers.
  2. 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.
  3. For web page extraction: This is basically a text processing task.
  4. Work incrementally to accomplish the task.
  5. Remember that in this domain, the problems generally tend to be ill-defined and solutions also tend to be imperfect.
  6. 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.
  7. Try and document your thought process at each step.
  8. Once done, write down the process by which you arrived at the final solution.
  9. 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?
  10. 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.