A hierarchical approach to the automatic categorization of medical documents