I wrote Elementize.py, inspired by the following image which I got a glimpse of someone’s Flickr upload:
Elementize.py converts text into element symbols, names, or atomic numbers, for example:
$ ./elementize.py --sep '-' Elementizing!
El-Em-E-N-Ti-Z-In-G!
$ ./elementize.py --sep '-' --datatype name Elementizing!
Ekaaluminium-Emanation-Exatanium-Nitrogen-Titanium-Zanium-Indium-Gravioli!
$ ./elementize.py --sep '-' --datatype number Elementizing!
31-86-?-7-22-?-49-?!
Elementizing a file:
$ ./elementize.py --sep '' "$(<elementize.py)" | tail -15
ElEmENTS = []
FOR set_name In ArGS.SeT.SPLiT(','):
IF set_name In ElEmENTSDICt:
ElEmENTS += ElEmENTSDICt[set_name]
ElSe:
RaISe VAlUEErROR('UNKNoWN ElEmENTS SeT NaMe: %S' % set_name)
FmT = WORDFORMAtTeR(DAtAtYPE=ArGS.DAtAtYPE, SeP=ArGS.SeP)
E = ElEmENTiZEr(ElEmENTS, word_formatter=FmT)
new_text = E.ElEmENTiZE(' '.JOIn(ArGS.WORD))
PrInT(new_text)
IF __name__ == '__main__':
MAIn()
1 Uses
For fun, of course. But you can use it to obscure the email address, although I don’t think you would ever receive any emails:
$ ./elementize.py --sep '-' --datatype name 'user@example.com'
Uranium-Selenium-Rodinium@Exatanium-Xenium-Americium-Phosphorus-Latinum-Exatanium.Cobalt-Mithril
2 Notes
Elementize.py has a few preset elements sets:
- Known elements, aka. real elements.
- Star Trek elements.
- Other elements: some other fictional elements.
- Fillin elements: filling in some missing letters, so any words can be converted.
The whole point of this script is to have element symbols of real elements and/or of fictional elements to represent the original text. This is for fun, so it has to have fictional elements, to make connection to those notable television shows or books. The problem is those fictional elements mostly are not element element. Even if they are created as an element, most likely, there is only official name, no element symbol and atomic number are assigned.
Because of that, I was unable to create a large set of fictional elements. Too many data are missing.
So, in a way, this script is only half-elementized. But it still has some potentials:
- add image generation — I am not image guy, so text version is good enough for me.
- use your own A-Z set — You can easily add new sets by editing the code with your own definitions, and it doesn’t have to be elements.
- Elementize bookmarklet? This requires writing in JavaScript, but if someone writes one, then you can read a web page in element symbols.
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.