python - what if you wanted to..?

Started by
7 comments, last by WinterDragon 7 years, 4 months ago

what if you wanted to create a new method for apa referencing via returning an instance of a string?

http://polydina.com

Advertisement

Since this topic got over 400 views, no answer and the only thing google tell me about APA is a scientific citation style, I am going to be the first one to admit that I have no idea of what you are talking about.

Could you further describe what you need and maybe give an example?

Currently working on a scene editor for ORX (http://orx-project.org), using kivy (http://kivy.org).

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

http://polydina.com

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.

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.)

http://polydina.com

Pretty sure you can already do this in Word.

There's also external tools like RefWorks and RefMe.

Though they are normally aimed at Harvard referencing.

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

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.

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.

http://polydina.com

This topic is closed to new replies.

Advertisement