Sign in to follow this  
WinterDragon

python - what if you wanted to..?

Recommended Posts

APA referencing is something you have to do in university essays. And in academic essays. What you do is whenever you use a quote or paraphrasing from something you give it a short reference to who wrote it.

Then at the end of the essay you list your references.

There is a strict code for style of referencing which includes capitalisation in a specific way.

 

From memory you capitalise the first letter of the title and the first letter of names and the first letter of subtitles.

so I was looking at methods like string.upper and string.lower and thinking could someone make a method like string.apa

or a program where you input a sentence and it turns it into apa or is that not possible because the user would not be able to give the computer enough information?

 

https://en.wikipedia.org/wiki/APA_style

 

http://www.waikato.ac.nz/__data/assets/pdf_file/0014/236120/apa-quick-guide.pdf

Share this post


Link to post
Share on other sites

I still don't have a clue what you are aiming for. Perhaps a few examples of a hypothetical APA function with concrete input and output could work?

As for the implementation, extending from the Python str itself is probably not possible, as str is likely implemented in C. Perhaps making a class that extends from string could be done, but it's use is quite limited. A simpler solution is perhaps to make a

def make_apa(text):
    # Do APA magic
    return apa

function. However if you want to really know what is possible, consult a higher Python power, in one of the Python boards or chats.

Edited by Alberth

Share this post


Link to post
Share on other sites

basically I think, user would have to input author first and surname, title of work, subtitle of work, year of publication, publisher and country/city.

 

then the output would be in the proper formatting, as seen here: "King, M. (2000). Wrestling with the angel: A life of Janet Frame. Auckland, New Zealand: Viking."

 

but that still wouldn't consider the names within titles which would need to also be titles (first letter capitalised.)

Share this post


Link to post
Share on other sites

The capitalisation in the title should already be correct. If you're expecting it to be incorrect, and are thinking that you can magically know when to fix it, that's a Hard Problem.

 

Assembling a Python string out of other Python strings is pretty trivial. The term you want is 'string formatting' - there is a lot of bad, esoteric, or lacking documentation about it, but this is a decent site: https://mkaz.tech/python-string-format.html

Share this post


Link to post
Share on other sites

I mean you could write functions that process strings and modify certain formatting, as long as you give enough understanding of the structure to the code then that's not a problem.

 

But you'll have a lot more trouble just sticking in some text and expecting it to figure out what a quote is or what is an author's name vs some other thing. That APA stuff seems to have quite a lot of rules.

Share this post


Link to post
Share on other sites

yea, I realised that too. that's not to say it can't be done. But I don't think it's something I'm passionate enough about to actually attempt - due to it being such a complex problem. It was just one of those ideas that I felt I could use a bit of advice about, feasibility-wise.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this