human
sorting dictionary by numeric value
assistant
Here is some code to sort dictionary `tag_weight` in reverse order by values cast to integers

sorted(list(tag_weight.items()), key=lambda x: int(x[1]), reverse=True)

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.