on clothing, you wet the cloth and then put it into the freezer
the frost then freezes the gum and also separates it away from the material so it's just a case of unpicking it afterwards
not too sure about doing the same thing on a carpet though as it may give you a bigger problem when you have to clean up the damp patch