# 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/compactmodel_io.py
# class CompactIOMachine:
#     """ Base class that implements compact model I/O.
# 
#     This is to replace the original :func:`compactio` decorator.
# 
#     """
#     def __init__(self, infodict, prefix, suffices):
#         """
# 
#         :param infodict: information about the model. Must contain the key 'classifier'.
#         :param prefix: prefix of names of the model file
#         :param suffices: suffices of the names of the model file
#         :type infodict: dict
#         :type prefix: str
#         :type suffices: list
#         """
#         self.infodict = infodict
#         self.prefix = prefix
#         self.suffices = suffices
# 
#     def savemodel(self, nameprefix):
#         """ Abstract method for `savemodel`.
# 
#         :param nameprefix: prefix of the model path
#         :type nameprefix: str
#         """
#         raise e.OperationNotDefinedException()
# 
#     def loadmodel(self, nameprefix):
#         """ Abstract method for `loadmodel`.
# 
#         :param nameprefix: prefix of the model path
#         :type nameprefix: str
#         """
#         raise e.OperationNotDefinedException()
# 
#     def save_compact_model(self, filename, *args, **kwargs):
#         """ Save the model in a compressed binary format.
# 
#         :param filename: name of the model file
#         :param args: arguments
#         :param kwargs: arguments
#         :type filename: str
#         :type args: dict
#         :type kwargs: dict
#         """
#         save_compact_model(filename, self.savemodel, self.prefix, self.suffices, self.infodict, *args, **kwargs)
# 
#     def load_compact_model(self, filename, *args, **kwargs):
#         """ Load the model in a compressed binary format.
# 
#         :param filename: name of the model file
#         :param args: arguments
#         :param kwargs: arguments
#         :type filename: str
#         :type args: dict
#         :type kwargs: dict
#         """
#         return load_compact_model(filename, self.loadmodel, self.prefix, self.infodict, *args, **kwargs)
# 
#     def get_info(self):
#         """ Getting information for the dressed machine.
# 
#         :return: dictionary of the information for the dressed machine.
#         :rtype: dict
#         """
#         return {'classifier': self.infodict['classifier'],
#                 'prefix': self.prefix,
#                 'suffices': self.suffices}


import json
import os
import warnings
import numpy as np
import shorttext.utils.kerasmodel_io as kerasio
import shorttext.utils.classification_exceptions as e
from shorttext.utils import tokenize
from shorttext.utils.compactmodel_io import CompactIOMachine

        self.with_gensim = False
        self.trained = True

    def word_to_embedvec(self, word):
        """ Convert the given word into an embedded vector.

        Given a word, return the corresponding embedded vector according to
        the word-embedding model. If there is no such word in the model,
        a vector with zero values are given.

        :param word: a word
        :return: the corresponding embedded vector
        :type word: str
        :rtype: numpy.ndarray
        """
        return self.wvmodel[word] if word in self.wvmodel else np.zeros(self.vecsize)

    def shorttext_to_matrix(self, shorttext):
        """ Convert the short text into a matrix with word-embedding representation.

        Given a short sentence, it converts all the tokens into embedded vectors according to
        the given word-embedding model, and put them into a matrix. If a word is not in the model,
        that row will be filled with zero.

        :param shorttext: a short sentence
        :return: a matrix of embedded vectors that represent all the tokens in the sentence
        :type shorttext: str
        :rtype: numpy.ndarray
        """

# 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/compactmodel_io.py
# class CompactIOMachine:
#     """ Base class that implements compact model I/O.
# 
#     This is to replace the original :func:`compactio` decorator.
# 
#     """
#     def __init__(self, infodict, prefix, suffices):
#         """
# 
#         :param infodict: information about the model. Must contain the key 'classifier'.
#         :param prefix: prefix of names of the model file
#         :param suffices: suffices of the names of the model file
#         :type infodict: dict
#         :type prefix: str
#         :type suffices: list
#         """
#         self.infodict = infodict
#         self.prefix = prefix
#         self.suffices = suffices
# 
#     def savemodel(self, nameprefix):
#         """ Abstract method for `savemodel`.
# 
#         :param nameprefix: prefix of the model path
#         :type nameprefix: str
#         """
#         raise e.OperationNotDefinedException()
# 
#     def loadmodel(self, nameprefix):
#         """ Abstract method for `loadmodel`.
# 
#         :param nameprefix: prefix of the model path
#         :type nameprefix: str
#         """
#         raise e.OperationNotDefinedException()
# 
#     def save_compact_model(self, filename, *args, **kwargs):
#         """ Save the model in a compressed binary format.
# 
#         :param filename: name of the model file
#         :param args: arguments
#         :param kwargs: arguments
#         :type filename: str
#         :type args: dict
#         :type kwargs: dict
#         """
#         save_compact_model(filename, self.savemodel, self.prefix, self.suffices, self.infodict, *args, **kwargs)
# 
#     def load_compact_model(self, filename, *args, **kwargs):
#         """ Load the model in a compressed binary format.
# 
#         :param filename: name of the model file
#         :param args: arguments
#         :param kwargs: arguments
#         :type filename: str
#         :type args: dict
#         :type kwargs: dict
#         """
#         return load_compact_model(filename, self.loadmodel, self.prefix, self.infodict, *args, **kwargs)
# 
#     def get_info(self):
#         """ Getting information for the dressed machine.
# 
#         :return: dictionary of the information for the dressed machine.
#         :rtype: dict
#         """
#         return {'classifier': self.infodict['classifier'],
#                 'prefix': self.prefix,
#                 'suffices': self.suffices}


# Path: shorttext/classifiers/embed/nnlib/VarNNEmbedVecClassification.py
import json
import os
import warnings
import numpy as np
import shorttext.utils.kerasmodel_io as kerasio
import shorttext.utils.classification_exceptions as e
from shorttext.utils import tokenize
from shorttext.utils.compactmodel_io import CompactIOMachine


        self.with_gensim = False
        self.trained = True

    def word_to_embedvec(self, word):
        """ Convert the given word into an embedded vector.

        Given a word, return the corresponding embedded vector according to
        the word-embedding model. If there is no such word in the model,
        a vector with zero values are given.

        :param word: a word
        :return: the corresponding embedded vector
        :type word: str
        :rtype: numpy.ndarray
        """
        return self.wvmodel[word] if word in self.wvmodel else np.zeros(self.vecsize)

    def shorttext_to_matrix(self, shorttext):
        """ Convert the short text into a matrix with word-embedding representation.

        Given a short sentence, it converts all the tokens into embedded vectors according to
        the given word-embedding model, and put them into a matrix. If a word is not in the model,
        that row will be filled with zero.

        :param shorttext: a short sentence
        :return: a matrix of embedded vectors that represent all the tokens in the sentence
        :type shorttext: str
        :rtype: numpy.ndarray
        """

        tokens = tokenize(shorttext)