@classmethod<EOL><INDENT>def train(self, s, path="<STR_LIT>"):<DEDENT>
model = {}<EOL>for w in re.findall("<STR_LIT>", s.lower()):<EOL><INDENT>model[w] = w in model and model[w] + <NUM_LIT:1> or <NUM_LIT:1><EOL><DEDENT>model = ("<STR_LIT>" % (k, v) for k, v in sorted(model.items()))<EOL>model = "<STR_LIT:\n>".join(model)<EOL>f = open(path, "<STR_LIT:w>")<EOL>f.write(model)<EOL>f.close()<EOL>
Counts the words in the given string and saves the probabilities at the given path.
            This can be used to generate a new model for the Spelling() constructor.