# Path: shorttext/utils/textpreprocessing.py
# def preprocess_text(text, pipeline):
# def text_preprocessor(pipeline):
# def oldschool_standard_text_preprocessor(stopwordsfile):
# def standard_text_preprocessor_1():
# def standard_text_preprocessor_2():
# 
# Path: shorttext/utils/gensim_corpora.py
# def generate_gensim_corpora(classdict, preprocess_and_tokenize=tokenize):
# def save_corpus(dictionary, corpus, prefix):
# def load_corpus(prefix):
# def update_corpus_labels(dictionary, corpus, newclassdict, preprocess_and_tokenize=tokenize):
# def tokens_to_fracdict(tokens):
# 
# Path: shorttext/utils/classification_exceptions.py
# class ModelNotTrainedException(Exception):
# class AlgorithmNotExistException(Exception):
# class WordEmbeddingModelNotExistException(Exception):
# class UnequalArrayLengthsException(Exception):
# class NotImplementedException(Exception):
# class IncorrectClassificationModelFileException(Exception):
# class OperationNotDefinedException(Exception):
#     def __init__(self):
#     def __init__(self, algoname):
#     def __init__(self, path):
#     def __init__(self, arr1, arr2):
#     def __init__(self):
#     def __init__(self, expectedname, actualname):
#     def __init__(self, opname):
# 
# Path: shorttext/utils/textpreprocessing.py
# def preprocess_text(text, pipeline):
# def text_preprocessor(pipeline):
# def oldschool_standard_text_preprocessor(stopwordsfile):
# def standard_text_preprocessor_1():
# def standard_text_preprocessor_2():


from abc import ABC, abstractmethod
from shorttext.utils import textpreprocessing as textpreprocess, gensim_corpora as gc, classification_exceptions as e
from shorttext.utils.textpreprocessing import tokenize
import numpy as np
        :type classdict: dict
        """
        self.dictionary, self.corpus, self.classlabels = gc.generate_gensim_corpora(classdict,
                                                                                    preprocess_and_tokenize=lambda sent: tokenize(self.preprocessor(sent)))
    @abstractmethod
    def train(self, classdict, nb_topics, *args, **kwargs):
        """ Train the modeler.

        This is an abstract method of this abstract class, which raise the `NotImplementedException`.

        :param classdict: training data
        :param nb_topics: number of latent topics
        :param args: arguments to be passed into the wrapped training functions
        :param kwargs: arguments to be passed into the wrapped training functions
        :return: None
        :raise: NotImplementedException
        :type classdict: dict
        :type nb_topics: int
        """
        self.nb_topics = nb_topics
        raise e.NotImplementedException()

    def retrieve_bow(self, shorttext):
        """ Calculate the gensim bag-of-words representation of the given short text.

        :param shorttext: text to be represented
        :return: corpus representation of the text
        :type shorttext: str
        :rtype: list
        """

# Path: shorttext/utils/textpreprocessing.py
# def preprocess_text(text, pipeline):
# def text_preprocessor(pipeline):
# def oldschool_standard_text_preprocessor(stopwordsfile):
# def standard_text_preprocessor_1():
# def standard_text_preprocessor_2():
# 
# Path: shorttext/utils/gensim_corpora.py
# def generate_gensim_corpora(classdict, preprocess_and_tokenize=tokenize):
# def save_corpus(dictionary, corpus, prefix):
# def load_corpus(prefix):
# def update_corpus_labels(dictionary, corpus, newclassdict, preprocess_and_tokenize=tokenize):
# def tokens_to_fracdict(tokens):
# 
# Path: shorttext/utils/classification_exceptions.py
# class ModelNotTrainedException(Exception):
# class AlgorithmNotExistException(Exception):
# class WordEmbeddingModelNotExistException(Exception):
# class UnequalArrayLengthsException(Exception):
# class NotImplementedException(Exception):
# class IncorrectClassificationModelFileException(Exception):
# class OperationNotDefinedException(Exception):
#     def __init__(self):
#     def __init__(self, algoname):
#     def __init__(self, path):
#     def __init__(self, arr1, arr2):
#     def __init__(self):
#     def __init__(self, expectedname, actualname):
#     def __init__(self, opname):
# 
# Path: shorttext/utils/textpreprocessing.py
# def preprocess_text(text, pipeline):
# def text_preprocessor(pipeline):
# def oldschool_standard_text_preprocessor(stopwordsfile):
# def standard_text_preprocessor_1():
# def standard_text_preprocessor_2():


# Path: shorttext/generators/bow/LatentTopicModeling.py
from abc import ABC, abstractmethod
from shorttext.utils import textpreprocessing as textpreprocess, gensim_corpora as gc, classification_exceptions as e
from shorttext.utils.textpreprocessing import tokenize
import numpy as np

        :type classdict: dict
        """
        self.dictionary, self.corpus, self.classlabels = gc.generate_gensim_corpora(classdict,
                                                                                    preprocess_and_tokenize=lambda sent: tokenize(self.preprocessor(sent)))
    @abstractmethod
    def train(self, classdict, nb_topics, *args, **kwargs):
        """ Train the modeler.

        This is an abstract method of this abstract class, which raise the `NotImplementedException`.

        :param classdict: training data
        :param nb_topics: number of latent topics
        :param args: arguments to be passed into the wrapped training functions
        :param kwargs: arguments to be passed into the wrapped training functions
        :return: None
        :raise: NotImplementedException
        :type classdict: dict
        :type nb_topics: int
        """
        self.nb_topics = nb_topics
        raise e.NotImplementedException()

    def retrieve_bow(self, shorttext):
        """ Calculate the gensim bag-of-words representation of the given short text.

        :param shorttext: text to be represented
        :return: corpus representation of the text
        :type shorttext: str
        :rtype: list
        """

        return self.dictionary.doc2bow(tokenize(self.preprocessor(shorttext)))