Next / Previous / Contents / Shipman's homepage

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

1. Introduction
2. The txny.py module: prologue
3. Some XML helper routines
3.1. getFirstChild(): Get the first child of a given name
3.2. textContent(): Retrieve the text of a node
3.3. getChildContent(): Get text from a child node
4. class Txny
4.1. Txny.genAbbrs(): Generate all valid bird codes
4.2. Txny.genTxKeys(): Generate all phylogenetic key numbers
4.3. Txny.lookupAbbr()
4.4. Txny.lookupCollision()
4.5. Txny.lookupSci()
4.6. Txny.lookupTxKey()
4.7. Txny.abbrToEng()
4.8. Txny.abbrToTex()
4.9. Txny.__init__()
4.10. Txny.__readTaxonomy()
4.11. txny.__buildMaps(): Index by key and scientific name
4.12. Txny.__addTaxonMaps(): Add a taxon to the internal dictionaries
4.13. Txny.__readAbbrs()
4.14. Txny.__readCollisions()
4.15. Txny.__addCollision(): Add one collision
5. class Hier
5.1. Hier.__init__()
5.2. Hier.canParentHaveChild()
5.3. Hier.formRank(), Hier.genusRank(), Hier.speciesRank(), and Hier.subgenusRank()
5.4. Hier.lookupRankCode()
5.5. Hier.__getItem__()
5.6. Hier.__iter__()
5.7. Hier.__len__()
6. class Rank: One taxonomic rank
6.1. Rank.__init__()
6.2. Rank.__str__()
7. class Taxon
7.1. Taxon.contains()
7.2. Taxon.nearestAncestor()
7.3. Taxon.childContaining(): Find child containing a descendant
7.4. Taxon.__cmp__(): Compare taxa in phylogenetic order
7.5. Taxon.__getitem__()
7.6. Taxon.__iter__()
7.7. Taxon.__len__()
7.8. Taxon.__str__()
7.9. Taxon.__init__(): The constructor
8. The abbr.py module
8.1. Prologue
8.2. abbreviate()
8.3. engComma(): Invert an English name
8.4. engDeComma(): Normalize an English name
8.5. class BirdId
8.6. BirdId.__init__()
8.7. BirdId.normalize()
8.8. birdId.engComma(): Inverted English name
8.9. BirdId.commafy(): Invert word order (static method)
8.10. BirdId.__str__()
8.11. BirdId.scan()
8.12. BirdId.scanFlat()
8.13. BirdId.scanAbbr()
8.14. BirdId.scanAbbrFlat()
8.15. BirdId.parse(): Parse a code from a string

1. Introduction

This 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: