This is just a passing idea but what about a trie-to-reverse-trie map?
Map:
a = 5
and = 51
ant = 52
as = 53
after = 54
Your string trie:
a
/ | \
n s f
/ \ |
d t t
|
e
|
r
Your integer trie:
5
/ / \ \
1 2 3 4
Now, you keep a pointer from the "word" nodes in each trie to point to each other in both representations.
So... e.g. Node 'r' in string trie points to node '4' in integer trie and vice versa.
a <-> 5 (root)
d <-> 1
t <-> 2
s <-> 3
r <-> 4
So, if you wanted to get the integer from a string; you'd search the string trie until you get to the node which represents the word. Now, following the pointer to the node which represents last digit of the integer. You go from that node to the root which will give you each digit of the integer (in reverse).
To reverse the integer, you essentially just keep track of how many times you've had to follow your parent pointer.
Say you had a link like this in your integer trie: (e.g. integer=14235)
5->3->2->4->1->root
You'd keep a height and result variables:
current=5; height=1; result=5
current=3; height*=10==10; result+=(current*height)==35
current=2; height*=10==100; result+=(current*height)==235
current=4; height*=10==1000; result+=(current*height)==4235
current=1; height*=10==10000; result+=(current*height)==14235
If you can keep the branching factor down to <=9 in the integer trie, you only have to store a byte in each node of the integer trie (outside of the pointers).
Obviously, you can do the reverse for integer-to-string....
Just a passing thought. Also, using a "compact trie" would be better but I used a traditional trie for example purposes.