import fasttext
import numpy as np

class Classifier:
    def __init__(self):
        self.model_path = './model_cooking.bin'

    def train(self):
        model = fasttext.load_model(self.model_path)
        self._save(model)

    def predict(self, title, body):
        model = fasttext.load_model(self.model_path)
        text = '{} {}'.format(title, body.replace('\n', ' '))
        labels_acc = model.predict(text) ## form = ((l, l, l), (a, a, a))
        labels = [label.replace('__label__', '') for label in labels_acc[0]]
        return labels

    def _save(self, model):
        model.save_model(self.model_path)

        

5ca187ae37972da2da99714cedcdcfb3671857fc
<mask token>


class Classifier:

    def __init__(self):
        self.model_path = './model_cooking.bin'
    <mask token>
    <mask token>

    def _save(self, model):
        model.save_model(self.model_path)

<mask token>


class Classifier:

    def __init__(self):
        self.model_path = './model_cooking.bin'
    <mask token>

    def predict(self, title, body):
        model = fasttext.load_model(self.model_path)
        text = '{} {}'.format(title, body.replace('\n', ' '))
        labels_acc = model.predict(text)
        labels = [label.replace('__label__', '') for label in labels_acc[0]]
        return labels

    def _save(self, model):
        model.save_model(self.model_path)

<mask token>


class Classifier:

    def __init__(self):
        self.model_path = './model_cooking.bin'

    def train(self):
        model = fasttext.load_model(self.model_path)
        self._save(model)

    def predict(self, title, body):
        model = fasttext.load_model(self.model_path)
        text = '{} {}'.format(title, body.replace('\n', ' '))
        labels_acc = model.predict(text)
        labels = [label.replace('__label__', '') for label in labels_acc[0]]
        return labels

    def _save(self, model):
        model.save_model(self.model_path)

import fasttext
import numpy as np


class Classifier:

    def __init__(self):
        self.model_path = './model_cooking.bin'

    def train(self):
        model = fasttext.load_model(self.model_path)
        self._save(model)

    def predict(self, title, body):
        model = fasttext.load_model(self.model_path)
        text = '{} {}'.format(title, body.replace('\n', ' '))
        labels_acc = model.predict(text)
        labels = [label.replace('__label__', '') for label in labels_acc[0]]
        return labels

    def _save(self, model):
        model.save_model(self.model_path)

import fasttext
import numpy as np

class Classifier:
    def __init__(self):
        self.model_path = './model_cooking.bin'

    def train(self):
        model = fasttext.load_model(self.model_path)
        self._save(model)

    def predict(self, title, body):
        model = fasttext.load_model(self.model_path)
        text = '{} {}'.format(title, body.replace('\n', ' '))
        labels_acc = model.predict(text) ## form = ((l, l, l), (a, a, a))
        labels = [label.replace('__label__', '') for label in labels_acc[0]]
        return labels

    def _save(self, model):
        model.save_model(self.model_path)

        
