d = {'word': {'a': {'b': 2}}, 'hello': {'a': {'b': 1}}, 'mouse': {'a': {'b':
    5}}}
[get(get(d, k), 'a.b') for k in list(d.keys())]
{k: get(get(d, k), 'a.b') for k in list(d.keys())}
Getting a dictionary value where part of the key is in a string