<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def phrase_replace(self, replace_dict):
 """ Replace phrases with single token, mapping defined in replace_dict """


        def r(tokens):
                text = ' ' + ' '.join(tokens)
                for k, v in replace_dict.items():                    
                    text = text.replace(" " + k + " ", " " + v + " ")
                return text.split()
        self.stems = list(map(r, self.stems))