Ejemplo n.º 1
0
    def fit_scaler(self, train_dir):
        """
        Fit a scaler on given data. Word vectors must be trained already.
        :param train_dir: directory with '.txt' files

        :return: fitted scaler object
        在给定的数据上安装一个定标器。单词向量必须已经过训练。

:param train_dir:directory和“.txt”文件



:返回:已安装的定标器对象
        """
        if not self.word2vec_model:
            raise ValueError('word2vec model is not trained. ' + \
                             'Run train_word2vec() first.')

        if self.scaler:
            print('WARNING! Overwriting already fitted scaler.',
                  file=sys.stderr)

        self.scaler = fit_scaler(train_dir, word2vec_model=self.word2vec_model)

        return self.scaler
Ejemplo n.º 2
0
    def fit_scaler(self, train_dir):
        """
        Fit a scaler on given data. Word vectors must be trained already.
        :param train_dir: directory with '.txt' files

        :return: fitted scaler object
        """
        if not self.word2vec_model:
            print('word2vec model is not trained. Run train_word2vec() first.')
            return

        if self.scaler:
            print('WARNING! Overwriting already fitted scaler.')

        self.scaler = fit_scaler(train_dir, word2vec_model=self.word2vec_model)

        return self.scaler
Ejemplo n.º 3
0
    def fit_scaler(self, train_dir):
        """
        Fit a scaler on given data. Word vectors must be trained already.
        :param train_dir: directory with '.txt' files

        :return: fitted scaler object
        """
        if not self.word2vec_model:
            print('word2vec model is not trained. Run train_word2vec() first.')
            return

        if self.scaler:
            print('WARNING! Overwriting already fitted scaler.')

        self.scaler = fit_scaler(train_dir, word2vec_model=self.word2vec_model)

        return self.scaler
Ejemplo n.º 4
0
  def fit_scaler(self, data: DataList):
    """
    Fit a scaler on given data. Word vectors must be trained already.
    :param data: directory with '.txt' files

    :return: fitted scaler object
    """
    if not self.word2vec_model:
      raise ValueError('word2vec model is not trained. ' +
                       'Run train_word2vec() first.')

    if self.scaler:
      print('WARNING! Overwriting already fitted scaler.',
            file=sys.stderr)

    self.scaler = fit_scaler(data, word2vec_model=self.word2vec_model)

    return self.scaler