import re


def PHONOTACTIC(pattern):
    """Takes a string representing the regex pattern of a particular
    phonotactic restriction, and returns a function that will count
    the number of times that pattern occurs in an unparsed output
    string."""
    def F(output):
        return len(re.findall(pattern, output))
    return F