On the Internet, acronyms are often used as an abbreviation. Examples are ASAP (as soon as possible), FAQ (frequently asked questions) and WYSIWYG (what you see is what you get). In informatics recursive acronyms are sometimes used: acronyms of which the combined parts are the same as the acronym: GNU (GNU is not Unix) or PNG (PNG is not GIF). Many can be used in all sorts of cases. The reason for the use of abbreviations is to make a text clearer. However, in the case of overuse, the text becomes harder to understand.
In the Monty Python sketch Tax on Thingy1 John Cleese plays a politician that says this to his three colleagues:
Gentlemen, our MP saw the PM this AM and the PM wants more LSD from the PIB by tomorrow AM or PM at the latest. I told the PM's PPS that AM was NBG so tomorrow PM it is for the PM nem. con. Give us a fag or I'll go spare. Now, the fiscal deficit with regard to the monetary balance, the current financial year excluding invisible exports, but adjusted of course for seasonal variations and the incremental statistics of the fiscal and revenue arrangements for the forthcoming annual budgetary period terminating in April.
Try figuring that one out. In an other Monty Python sketch we can hear Eric Idle saying:
In a nutshell, the problem of the CFJ has arisen from a dispute amongst the members of the PBFC who have decided to appeal to the NTSU for permission to take action against the LSM in their dispute with the NFOR. The NFO itself has come out firmly against the CYP, accusing the BFO of not listening to the KY or the more moderate CSI and rejecting the report of the BACON on AK achievements during the current BFP in favor of the SDSCP. This dispute, which arose last MAY, has spread to the TFO, which itself is appealing a BRN ruling to the GRM against the PYB elements of the NPU. Well, will it be McGumby's FNP, or can Harkham's DNY provide last minute support to the FDO to bolster the failing appeal of the BFN FUCK YOU. Or is it simply too late to understand just what is going on here? This is Robert Allison in MANC... (whisper "Manchester") Thank you.
The acronym TMA in the title of this assignment stand for Too Many Acronyms, a series of cartoons of Yu-San Moon in which the conversations are held exclusively in acronyms.
Write a function TMA that takes the locations of two text files as its arguments. The first text file contains a number of lines of text in which several acronyms occur. The second text file contains an acronym on every line, followed by an tab character and the meaning of the acronym. The function should print the lines of the first text file, and replace the first occurrence of acronym $$A$$ with its meaning $$B$$ that is defined in the second text file, followed by a space and then the acronym $$A$$ between brackets. If the acronym $$A$$ is repeated thereafter, then the acronym can remain.
In the following example session we assume that the files taxonthingy.txt2 and acronyms.txt3 are located in the current directory.
>>> TMA('taxonthingy.txt', 'acronyms.txt')
Gentlemen, our Member of Parliament (MP) saw the Prime Minister (PM) this
Ante Meridiem (AM) and the PM wants more Pounds, Shillings and Pence (LSD)
from the Publishers' Information Bureau (PIB) by tomorrow AM or PM at the
latest. I told the PM's Principal Private Secretary (PPS) that AM was
No Bloody Good (NBG) so tomorrow PM it is for the PM nem. con.
Give us a fag or I'll go spare.