Spring break
Socially distant but united
Our world has now changed — While it's scary, you are strong — Together we are
Look both ways
Agenda
- Get ready to move on by reviewing the past.
To do
- Get a UVA Zoom account and if it is an option download software
- Become familar with Class 26 material — need to do a solid read
Let's reconnect — direct link to Monday March 16 and Wednesday March 18 @ 2 PM Zoom town hall meetings
- When you click the link -- you will get a chance to download the software
Monday townhall
- A summary is available.
Preparing for Friday
- If you have not updated module url.py since 3/3/2020, please do so. The module now has a function
get_dictionary( link )
that returns the contents of the CSV-formatted page indicated by parameterlink
as a dictionary.
- Please look at the following examples.
- Problem whats_up.py
- Problem unfunctional.py
- A brief video of me mostly focusing on the programs is out there.
- These programs both have the ability to translate user text. If a word is known to its translation dictionary, it is added to the output string accumulation. If instead, a word is not known, the word surrounded by question marks is added to the accumulation. For example, the French word
heureuse
for happiness is not in the our dictionary, so it would be translated as?heureuse?
.
- Some possible interactions are:
Enter phrase to be translated: dónde está mi lápiz
where is my pencil
Enter phrase to be translated: hvor 是 该 tumili maleri av Munch
where is the scream painting by Münch
Enter phrase to be translated: je ouch-ouch-ouch ból svayam
I ?ouch-ouch-ouch? hurt myself
- Both programs use the CSV web file babelfish as a translation dictionary.
a, a
aab, water
aamadam, came
...
ziba, beautiful
zur, to
zu, to
zwei, two
...
Why are the examples important
- I believe if you look at program whats_up.py, it should seem straightfoward.
- It gets the translation dictionary
- It gets the phrase the user wants translated.
- It builds up the translation by looking at each word in the phrase and either translates it or flags it to the overall translation.
- Problem unfunctional.py does not use the module
url.py
that I developed. It only uses the standard Python modules. And while understandable, careful attention needs to be made to make sure that it first properly reads and processes the web file into a working dictionary.
- Having modules to help us out is not only handy but crucial for solving bigger and/or more complicated problems.
- Writing a function once allows it to be used whenever the same task needs to be performed. They simplify problem solving.
- For example, function
url.get_dictionary()
is not only useful here, but it also useful in homework common_commodities.py.
© 2020 Jim Cohoon | Resources from previous semesters are available. |