It's UWAweek 48

help2003/help4407

This forum is provided to promote discussion amongst students enrolled in Open Source Tools and Scripting.

Please consider offering answers and suggestions to help other students! And if you fix a problem by following a suggestion here, it would be great if other interested students could see a short "Great, fixed it!"  followup message.

How do I ask a good question?
Displaying the 8 articles in this topic
Showing 8 of 564 articles.
Currently no other people reading this forum.


 UWA week 17 (1st semester, week 8) ↓
SVG not supported

Login to reply

👍?
helpful
1:24pm Fri 29th Apr, Michael W.

Hi, Just to let you know that I have posted an updated version of title_case.py, which deals with the issue of hypenated names not being capitalised correctly. Before this, Timor-Leste was converted to Timor-leste, which is clearly not correct. That deficiency has been corrected in the new version. Don't worry, by the way, I'll be using the corrected version in testing. Have a good weekend Cheers MichaelW


SVG not supported

Login to reply

👍?
helpful
1:29pm Fri 29th Apr, Michael W.

BTW, also in response to a question raised at today's lab session, I'll begin Monday's lecture with a comparison of Shell for and while loops, which you use and why. Have a good weekend Cheers MichaelW


SVG not supported

Login to reply

👍?
helpful
2:15pm Fri 29th Apr, Abhishek A.

Hi Michael, I don't plan to use this python file as I am using grep in my solution and it handles the cases we are trying to deal with the title_case.py file. I hope we won't be penalized for not using this python file in our solution. Thanks, Abhishek


SVG not supported

Login to reply

👍?
helpful
2:24pm Fri 29th Apr, ANONYMOUS

Likewise. I'm a little confused, as the grep method is much simpler?


SVG not supported

Login to reply

👍?
helpful
3:09pm Fri 29th Apr, ANONYMOUS

I'm very confused too, like even if we want to use it, what are steps to use the python file on our targeted data? I have put the python file in the same directory as my 'incidence' file. But I am not sure how to link them and apply the data cleaning process. It will be greatly appreciated if clearer steps can be provided.


SVG not supported

Login to reply

👍?
helpful
3:15pm Fri 29th Apr, ANONYMOUS

You should be able to call the python file like any other script, within your shell script. Eg. python_file "text" It just takes an input, returns an output.


SVG not supported

Login to reply

👍x3
helpful
3:36pm Fri 29th Apr, ANONYMOUS

ANONYMOUS wrote:

You should be able to call the python file like any other script, within your shell script. Eg. python_file "text"

It just takes an input, returns an output.

It should be noted that this only works if you update your path; according to Michael, this requires you including ".", allowing you to call title_case.py from anywhere in the docker. (See Michael's answer https://secure.csse.uwa.edu.au/run/help4407?p=np&opt=B158)

This, however, is considered (very) bad practice and is consistently advised against in Unix circles. https://unix.stackexchange.com/questions/65700/is-it-safe-to-add-to-my-path-how-come.

If you are wondering how to use the script in your code, once you have done the above (don't do that) the intention is that you would have a line in your shell script along the lines of:

# Anti-bugging here to determine this is a string
country=$1
capitalised_country="$(title_case $country)"
# Find the capitalised_country  (and a strong coffee)

Hence if we ran ./malaria_incidence belize, the above would convert belize to Belize, and thus be able to locate the capitalised Belize in the incidenceOfMalaria.csv.

As has been identified above, however, this seems unnecessary given that grep -i will find Belize from bElIzE. This makes it unclear as to what method Michael is expecting to be used, as if you are using grep this is unnecessary...


SVG not supported

Login to reply

👍?
helpful
3:52pm Fri 29th Apr, ANONYMOUS

Sorry, my bad. That was just intended to be pseudocode. You're right. Call your scripts correctly.

The University of Western Australia

Computer Science and Software Engineering

CRICOS Code: 00126G
Written by [email protected]
Powered by history
Feedback always welcome - it makes our software better!
Last modified  1:17AM Sep 14 2022
Privacy policy