| Computing >> CLT >> COMP348 home >> Tutorials >> Tutorial Week 2 |
COMP348 Document Processing and the Semantic WebTutorial Week 2Language Technology and PythonApplications that Benefit from Intelligent Text ProcessingOn the lectures you have seen some examples of applications that will benefit from language technology. The list is by no means exhaustive. In this first exercise you will discuss in group other applications.
Regular Expressions in Python
More Regular Expressions in PythonSometimes words are hyphenated across lines; consider the following text: At the period when these events took place, I had just returned from a scientific research in the disagreeable territory of Nebraska, in the United States. In virtue of my office as Assistant Professor in the Museum of Natural History in Paris, the French Government had attached me to that expedition. After six months in Nebraska, I arrived in New York to- wards the end of March, laden with a precious collection. My departure for France was fixed for the first days in May. Meanwhile I was occupying myself in classifying my minera- logical, botanical, and zoological riches, when the accident happened to the Scotia. Write a Python function that will count how many times a word appears in the text, `repairing' the hyphen breaks.
Take care of matching full words. For example, suppose that the above text is stored in the variable >>> myCount(Nebraska,text) 2 >>> myCount(towards,text) 1 >>> myCount(erio,text) 0 >>> Mark Dras or Diego Molla |
