If I understand the task correctly, it is to map a word into another word that belongs to the set of words that have the same letter frequency distribution.
So a possible solution is to define a representation for a letter frequency distribution, and use an associative data type for the mapping.
Since the problem does not concern itself with prefixes, there is no need for a prefix tree - in Python, a simple dict would do.
A few words about style: when you write code, you have to come up with names for variables, functions, and other things. In this case, it seems you just went ahead and wrote down the first thing that came to mind, which is sometimes verbose because you're still in problem exploration mode and things are not clear. It's OK to do that, but please consider re-naming later on, so that instead of a first-thing-I-thought-of name, you'll have a name that gives the reader a sense of clarity. The process of doing that usually leads to better understanding of the problem and perhaps better code. With experience, you'll find that the need to re-name is reduced.
As a rule of thumb, the length of the name should correlate with the its scope. Names with indefinite scope tend to be long, while names with limited scopes tend to be shorter.
Finally, I encourage you to write more posts, and hope my critique is helpful.
So a possible solution is to define a representation for a letter frequency distribution, and use an associative data type for the mapping.
Since the problem does not concern itself with prefixes, there is no need for a prefix tree - in Python, a simple dict would do.
A few words about style: when you write code, you have to come up with names for variables, functions, and other things. In this case, it seems you just went ahead and wrote down the first thing that came to mind, which is sometimes verbose because you're still in problem exploration mode and things are not clear. It's OK to do that, but please consider re-naming later on, so that instead of a first-thing-I-thought-of name, you'll have a name that gives the reader a sense of clarity. The process of doing that usually leads to better understanding of the problem and perhaps better code. With experience, you'll find that the need to re-name is reduced.
As a rule of thumb, the length of the name should correlate with the its scope. Names with indefinite scope tend to be long, while names with limited scopes tend to be shorter.
Finally, I encourage you to write more posts, and hope my critique is helpful.