Home | Trees | Indices | Help |
|
---|
|
A mapping from strings to id integers. This class is used for defining the ids for classes and features of machine learning systems.
|
|||
|
|||
int or None |
|
||
|
|||
|
|||
str or None |
|
||
|
|||
|
|||
|
|||
|
|
Creates a new IdSet or loads one from a dictionary or a file. To create a new, empty set: idset = IdSet(firstNumber = x). To create a set from a str->int dictionary: idset = IdSet(idDict = x). To load a dictionary from a file: idset = IdSet(filename = x).
|
Returns the id number for a name. If the name doesn't already have an id, a new id is defined, unless createIfNotExist is set to false, in which case None is returned for these cases.
|
Give a specific id for a certain name. Neither the name nor the id must exist in the set and the id must be smaller than the largest id already in the set. Usually this method is used only when inserting name/id pairs from an existing source. |
Returns the name corresponding to the identifier. If the identifier doesn't exits, returns None.
|
Returns a sorted list of all names. Can be slow for large IdSets. |
Returns a sorted list of id numbers. Can be slow for large IdSets. |
Loads name/id pairs from a file. The IdSet is cleared of all existing ids before loading the ones from the file. |
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Thu Jul 19 18:20:45 2012 | http://epydoc.sourceforge.net |