Abstract
Describes the implementation of a system for representing a classification of a set of birds, using the Python programming language and XML (Extensible Markup Language).
This publication is available in Web form and also as a PDF document. Please
forward any comments to tcc-doc@nmt.edu.
Table of Contents
txny.py module: prologueclass TxnyTxny.genAbbrs(): Generate
all valid bird codesTxny.genTxKeys(): Generate all
phylogenetic key numbersTxny.lookupAbbr()Txny.lookupCollision()Txny.lookupSci()Txny.lookupTxKey()Txny.abbrToEng()Txny.abbrToTex()Txny.__init__()Txny.__readTaxonomy()txny.__buildMaps(): Index by key and
scientific nameTxny.__addTaxonMaps(): Add a taxon
to the internal dictionariesTxny.__readAbbrs()Txny.__readCollisions()Txny.__addCollision(): Add one
collisionclass Hierclass Rank: One taxonomic rankclass Taxonabbr.py moduleabbreviate()engComma(): Invert an English nameengDeComma(): Normalize an English
nameclass BirdIdBirdId.__init__()BirdId.normalize()birdId.engComma(): Inverted English
nameBirdId.commafy(): Invert word order
(static method)BirdId.__str__()BirdId.scan()BirdId.scanFlat()BirdId.scanAbbr()BirdId.scanAbbrFlat()BirdId.parse(): Parse a code
from a stringThis document describes the internals of the programs associated with A system for representing bird taxonomy. Refer to that document for downloadable online files.
Here, in literate style, is the source code for the Python
objects in the txny.py module.
In addition to its utility in bird records management, this module is also an example of several useful techniques:
Literate programming, the writing of code and documentation as a single process with a single source file. See A source extractor for lightweight literate programming.
Cleanroom (zero-defect) programming. See Toward Zero-defect Programming by Allan M. Stavely (Addison-Wesley, 1999, ISBN 0-201-38595-3) for an overview of this methodology, and see also the author's Cleanroom pages for details of the method as he practices it.
XML processing using the Python lxml
package; see Python XML processing with lxml.