Carpets absorb smells from everything. When we were first dating my wife's roommate cooked interesting foods all of the time and left her clothing in piles everywhere. When she moved out we were left with a wall-to-wall stink and no time for professional cleaning. Sprays just cover smells, you really need to remove the particles that are causing the lingering smells. The best method for this is to dust the carpet with Borax. Grind the Borax in by walking over the entire floor and letting it sit for about an hour. Then vaccuum the entire floor with a shop vac with a fine particulate filter. Use the wide attachment and work small areas constantly changing direction. This is hard work, but well worth the effort. Once your have completely vaccuumed, the smells will be gone for good.