def fit(self, X, y, model_filename=None):
train_file = "<STR_LIT>"<EOL>X = [x.replace("<STR_LIT:\n>", "<STR_LIT:U+0020>") for x in X]<EOL>y = [_.replace("<STR_LIT:U+0020>", "<STR_LIT:->") for _ in y]<EOL>lines = ["<STR_LIT>".format(self.prefix, j, i) for i, j in zip(X, y)]<EOL>content = "<STR_LIT:\n>".join(lines)<EOL>write(train_file, Text(content))<EOL>if model_filename:<EOL><INDENT>self.estimator = ft.supervised(train_file, model_filename)<EOL><DEDENT>else:<EOL><INDENT>self.estimator = ft.supervised(train_file, '<STR_LIT>')<EOL>os.remove('<STR_LIT>')<EOL><DEDENT>os.remove(train_file)<EOL>
Fit FastText according to X, y

        Parameters
        ----------
        X : list of string
            each item is a raw text
        y : list of string
            each item is a label