opensextant.TaxCat
index
./python/opensextant/TaxCat.py

A simple interface to creating a taxonomic catalog ("taxcat") for OpenSextant TaxMatcher  to use.
prerequisites:    See XTax README

 
Modules
       
os

 
Classes
       
builtins.object
TaxCatalogBuilder
Taxon

 
class TaxCatalogBuilder(builtins.object)
    TaxCatalogBuilder(server=None, test=False)
 

 
  Methods defined here:
__init__(self, server=None, test=False)
API to assist in building taxon nodes and storing them in Solr.
:param server: solr server http URL
add(self, catalog, taxon: opensextant.TaxCat.Taxon)
Add the given taxon to the index, increment the internal counter.
:param catalog:  catalog ID
:param taxon:
:return:
add_stopwords(self, stopfile)
add_wordlist(self, catalog, datafile, start_id, taxnode=None, minlen=1)
Given a simple one column word list file, each row of data is added
  to catalog as a Taxon; taxnode may be used as a prefix for the words
 
Add a series of organized word lists to a single Catalog, but manage 
each wordlist with some prefix taxon path.
 
   add_wordlist('CAT', f1, 400, taxonode='first')
   add_wordlist('CAT', f2, 500, taxonode='second')
   add_wordlist('CAT', f3, 600, taxonode='third')
   add_wordlist('CAT', f4, 700, taxonode='fourth')
optimize(self)
purge(self, catalog)
save(self, flush=False)
set_server(self, svr)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class Taxon(builtins.object)
     Methods defined here:
__init__(self)
Initialize self.  See help(type(self)) for accurate signature.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
Functions
       
add_bool(dct, f, val, default=None)
add_text(dct, f, val)
add_text offers a basic idea of how to add values to dict
before sending to solr.   TEXT strings may need scrubbing
but you just add non-TEXT values.
add_value(f, val, case=0)
add  a value to a given field, f;  And normalize case if non-zero.
case = CASE_LOWER | CASE_UPPER | 0(default) no change
create_taxcat(solr_server)
:param solr_server: URL or host:port
:return:
get_starting_id(cat)
For well-known catalogs, determine the default catatag ID range.
:param cat:
:return:
get_taxnode(t, val)
:param t:
:param val:
:return:

 
Data
        CASE_LOWER = 1
CASE_UPPER = 2
CATALOG_REGISTRY = {'DEFAULT': 0, 'JRC': 3000000, 'WFB': 100000}
DEFAULT_SOLR_SERVER = '127.0.0.1:7000'
SOLR_SERVER = 'http://127.0.0.1:7000/solr/taxcat'