def _preprocess(inp):
        """Revise wording to match canonical and expected forms."""
        inp = re.sub(r'(\b)a(\b)', r'\g<1>one\g<2>', inp)
        inp = re.sub(r'to the (.*) power', r'to \g<1>', inp)
        inp = re.sub(r'to the (.*?)(\b)', r'to \g<1>\g<2>', inp)
        inp = re.sub(r'log of', r'log', inp)
        inp = re.sub(r'(square )?root( of)?', r'sqrt', inp)
        inp = re.sub(r'squared', r'to two', inp)
        inp = re.sub(r'cubed', r'to three', inp)
        inp = re.sub(r'divided?( by)?', r'divide', inp)
        inp = re.sub(r'(\b)over(\b)', r'\g<1>divide\g<2>', inp)
        inp = re.sub(r'(\b)EE(\b)', r'\g<1>e\g<2>', inp)
        inp = re.sub(r'(\b)E(\b)', r'\g<1>e\g<2>', inp)
        inp = re.sub(r'(\b)pie(\b)', r'\g<1>pi\g<2>', inp)
        inp = re.sub(r'(\b)PI(\b)', r'\g<1>pi\g<2>', inp)

        def findImplicitMultiplications(inp):
            """Replace omitted 'times' references."""

            def findConstantMultiplications(inp):
                split = inp.split(' ')
                revision = ""

                converter = NumberService()
                for i, w in enumerate(split):
                    if i > 0 and w in MathService.__constants__:
                        if converter.isValid(split[i - 1]):
                            revision += " times"
                    if not revision:
                        revision = w
                    else:
                        revision += " " + w

                return revision

            def findUnaryMultiplications(inp):
                split = inp.split(' ')
                revision = ""

                for i, w in enumerate(split):
                    if i > 0 and w in MathService.__unaryOperators__:
                        last_op = split[i - 1]

                        binary = last_op in MathService.__binaryOperators__
                        unary = last_op in MathService.__unaryOperators__

                        if last_op and not (binary or unary):
                            revision += " times"
                    if not revision:
                        revision = w
                    else:
                        revision += " " + w

                return revision

            return findUnaryMultiplications(findConstantMultiplications(inp))

        return findImplicitMultiplications(inp)
Revise wording to match canonical and expected forms.