Class of strings generated from a pattern by substitutions, in formal language theory and machine learning