def _mechanic_text_processor_factory(text_pattern, attribute_name):
    """
    Generic function factory to generate text based processors.

    :param text_pattern: Text pattern to look for.
    :param attribute_name: Attribute name to save the value to.
    :return: a processor for the provided text pattern.
    """
    def _mechanic_text_processor(card, text_mechanics):
        present = text_pattern in text_mechanics
        if present:
            card[attribute_name] = 1
            text_mechanics = text_mechanics.replace(text_pattern, '')
        return text_mechanics
    return _mechanic_text_processor