When i use a classifier,- i apply my target variables to a Dictionary object to get them as ints using intern(). I run my classification and test referencing my Dictionary. Which is fine as long as my Dictionary object is still in memory. However, later, i deserialize my model and want to use it, but the Dictionary object that has my mappings from target variable --> int is no longer in memory, so i can't interpret the vector that i get from querying my model.
So my question is: how can I restore the Dictionary object? My work around has been to get the dictionary values() when i create the model and write them to disk when i write the model to disk so that i can grab them later. But this seems clumsy, so I assume i'm missing something. Can I serialize the dictionary somehow? Is it serialized with the model? I've googled around and found nothing. thanks
