MCPcopy Create free account

hub / github.com/Alic-yuan/nlp-beginner-finish / functions

Functions123 in github.com/Alic-yuan/nlp-beginner-finish

↓ 16 callersMethodload
Load pre-trained embedding weights. Arguments: vectors {torch.Tensor} -- from "TEXT.vocab.vectors".
task3/model.py:51
↓ 7 callersMethod__init__
Arguments: vector_size {int} -- word embedding size. vocab_size {int} -- the size of the vocabulary. hidd
task3/model.py:266
↓ 7 callersMethodrun
(self)
task5/train.py:59
↓ 4 callersMethodinit_hidden
(self, layer_num, batch_size)
task5/model.py:39
↓ 4 callersFunctionnative_content
(content)
task2/cnews_loader.py:26
↓ 4 callersFunctionread_category
读取分类目录,固定
task2/cnews_loader.py:87
↓ 4 callersFunctionread_vocab
读取词汇表
task2/cnews_loader.py:77
↓ 3 callersFunctionbatch_iter
生成批次数据
task2/cnews_loader.py:119
↓ 3 callersFunctioncorrect_predictions
Compute the number of predictions that match some target classes in the output of a model. Args: output_probabilities: A tensor o
task3/utils.py:92
↓ 3 callersFunctionget_tags
(path, tag, tag_map)
task4/utils.py:15
↓ 3 callersFunctionopen_file
常用文件操作,可在python2和python3间切换. mode: 'r' or 'w' for read or write
task2/cnews_loader.py:33
↓ 3 callersFunctionprocess_file
将文件转换为id表示
task2/cnews_loader.py:103
↓ 2 callersMethodbatch_iter
迭代器,将数据分批传给模型
task1/datahelper/data_process.py:85
↓ 2 callersFunctionget_data
(config)
task5/dataHandler.py:154
↓ 2 callersMethodlog_likelihood
(self, x, tags)
task4/model/LSTM_CRF.py:39
↓ 2 callersFunctionmasked_softmax
Apply a masked softmax on the last dimension of a tensor. The input tensor and mask should be of size (batch, *, sequence_length). Args:
task3/utils.py:23
↓ 2 callersFunctionpad_sequences
pad_sequences 把序列长度转变为一样长的,如果设置了maxlen则长度统一为maxlen,如果没有设置则默认取 最大的长度。填充和截取包括两种方法,post与pre,post指从尾部开始处理,pre指从头部 开始处理,默认都是从尾部开始。 Argumen
task3/data.py:89
↓ 2 callersFunctionread_file
读取文件数据
task2/cnews_loader.py:44
↓ 2 callersMethodtrain
(self)
task4/main.py:63
↓ 2 callersFunctionvalidate
Compute the loss and accuracy of a model on some validation dataset. Args: model: A torch module for which the loss and accuracy must
task3/utils.py:107
↓ 2 callersFunctionweighted_sum
Apply a weighted sum on the vectors along the last dimension of 'tensor', and mask the vectors in the result with 'mask'. Args: t
task3/utils.py:50
↓ 1 callersMethod__init__
(self)
task2/torch_model.py:14
↓ 1 callersFunctionbuild_vocab
(train_dir, vocab_size=5000)
task3/data.py:129
↓ 1 callersFunctiondata2pkl
()
task4/data/data_renmin_word.py:66
↓ 1 callersFunctionevaluate
测试集上准曲率评估
task1/main.py:16
↓ 1 callersFunctionevaluate
测试集上准确率评估
task2/torch_train.py:15
↓ 1 callersFunctionf1_score
(tar_path, pre_path, tag, tag_map)
task4/utils.py:38
↓ 1 callersFunctionflat_gen
(x)
task4/data/data_renmin_word.py:94
↓ 1 callersFunctionformat_result
(result, text, tag)
task4/utils.py:3
↓ 1 callersMethodgenerate_head
生成藏头诗
task5/sample.py:71
↓ 1 callersMethodgenerate_head_test
生成藏头诗
task5/train.py:90
↓ 1 callersMethodgenerate_poetry
模式一:随机生成诗歌 模式二:生成藏头诗 模式三:给定首句生成诗 :return:
task5/sample.py:104
↓ 1 callersMethodgenerate_random
自由生成一首诗歌
task5/sample.py:40
↓ 1 callersFunctionget_data
()
task1/main.py:30
↓ 1 callersMethodget_tfidf
提取tfidf特征
task1/datahelper/data_process.py:61
↓ 1 callersFunctionget_time_dif
获取已经使用的时间
task1/main.py:9
↓ 1 callersFunctionhandle_json
读入json文件,返回诗句list,每一个元素为一首诗歌(str类型表示)
task5/dataHandler.py:42
↓ 1 callersFunctioniselement
(e)
task4/data/data_renmin_word.py:95
↓ 1 callersMethodload_data
(self)
task5/sample.py:23
↓ 1 callersMethodload_model
(self)
task5/sample.py:28
↓ 1 callersFunctionload_sentences
(file, data_size=None)
task3/data.py:36
↓ 1 callersFunctionload_vocab
(vocab_file)
task3/data.py:60
↓ 1 callersMethodlr
(self)
task1/lr_model.py:10
↓ 1 callersFunctionmain
(train_file, dev_file, vocab_file, target_dir, max_length=50, hidden_size=300, drop
task3/train.py:9
↓ 1 callersFunctionopen_file
常用文件操作,可在python2和python3间切换. mode: 'r' or 'w' for read or write
task3/data.py:27
↓ 1 callersFunctionoriginHandle
()
task4/data/data_renmin_word.py:9
↓ 1 callersFunctionoriginHandle2
()
task4/data/data_renmin_word.py:35
↓ 1 callersFunctionpad_sequences
code from keras Pads each sequence to the same length (length of the longest sequence). If maxlen is provided, any sequence longer th
task5/dataHandler.py:77
↓ 1 callersFunctionparse_raw_data
获取原数据并预处理 :param data_path: 数据存放的路径 :param category: 数据的类型 :param author: 作者名称 :param constrain: 长度限制 :return: list ['床前明
task5/dataHandler.py:9
↓ 1 callersFunctionpre_data
分词去停用词
task1/predict.py:8
↓ 1 callersMethodpre_data
数据预处理
task1/datahelper/data_process.py:34
↓ 1 callersMethodpredict
(self, message)
task2/torch_test.py:30
↓ 1 callersFunctionpredict_line
预测结果
task1/predict.py:28
↓ 1 callersMethodprovide_data
提供数据
task1/datahelper/data_process.py:74
↓ 1 callersFunctionread_categories
读取类别
task1/predict.py:21
↓ 1 callersMethodread_data
读取数据
task1/datahelper/data_process.py:18
↓ 1 callersMethodsave_categories
将文本的类别写到本地
task1/datahelper/data_process.py:29
↓ 1 callersFunctionsentence2split
()
task4/data/data_renmin_word.py:58
↓ 1 callersFunctionsentence_parse
对文本进行处理,取出脏数据
task5/dataHandler.py:22
↓ 1 callersFunctionsort_by_seq_lens
(batch, sequences_lengths, descending=True)
task3/utils.py:7
↓ 1 callersFunctiontrain
(X_train, X_test, y_train, y_test)
task1/main.py:39
↓ 1 callersFunctiontrain
Train a model for one epoch on some input data with a given optimizer and criterion. Args: model: A torch module that must be tra
task3/utils.py:190
↓ 1 callersFunctiontrain
()
task2/torch_train.py:47
↓ 1 callersMethodtrain
(self, data_loader, model, optimizer, criterion, char_to_ix, ix_to_chars)
task5/train.py:20
↓ 1 callersFunctionword_index
(p_sentences, h_sentences, word2idx, max_char_len)
task3/data.py:46
FunctionX_padding
(words)
task4/data/data_renmin_word.py:120
Method__getitem__
(self, index)
task4/main.py:37
Method__getitem__
(self, idx)
task3/data.py:24
Method__init__
(self, X, Y, *args, **kwargs)
task4/main.py:34
Method__init__
(self, embedding_dim, hidden_dim, dropout, word2id, tag2id)
task4/model/LSTM_CRF.py:7
Method__init__
(self, embedding_dim, hidden_dim, dropout, word2id, tag2id)
task4/model/LSTM.py:6
Method__init__
(self, config, seq_length)
task1/lr_model.py:5
Method__init__
(self, dataset_path=None, stopwords_path=None, model_save_path=None)
task1/datahelper/data_process.py:13
Method__init__
rnn_type must be a class inheriting from torch.nn.RNNBase
task3/layers.py:27
Method__init__
(self, LCQMC_file, vocab_file, max_char_len)
task3/data.py:13
Method__init__
Arguments: vector_size {int} -- word embedding size. vocab_size {int} -- vocabulary size. Keyword Arguments:
task3/model.py:37
Method__init__
(self, input_size, hidden_size)
task3/model.py:69
Method__init__
(self)
task3/model.py:89
Method__init__
Arguments: input_size {int} -- input size to the feedforward neural network. output_size {int} -- output size of the
task3/model.py:132
Method__init__
(self)
task3/model.py:167
Method__init__
Arguments: input_size {int} -- input size to the feedforward neural network. output_size {int} -- output size of the
task3/model.py:194
Method__init__
(self, input_size, output_size, class_num, activation='relu', dropout=0.5)
task3/model.py:233
Method__init__
(self)
task5/train.py:14
Method__init__
(self)
task5/sample.py:11
Method__init__
(self, vocab_size, embedding_dim, hidden_dim, device, layer_num)
task5/model.py:8
Method__init__
(self)
task2/torch_test.py:24
Method__init__
(self)
task2/torch_test.py:43
Method__init__
(self)
task2/torch_model.py:35
Method__len__
(self)
task4/main.py:40
Method__len__
(self)
task3/data.py:21
Method_parse
根据字典kwargs 更新 config参数
task4/config.py:25
Functionbuild_vocab
根据训练集构建词汇表,存储
task2/cnews_loader.py:59
Methodforward
(self, x)
task4/model/LSTM_CRF.py:25
Methodforward
(self, x)
task4/model/LSTM.py:20
Methodforward
Apply dropout to the input batch of sequences. Args: sequences_batch: A batch of sequences of vectors that will serve
task3/layers.py:11
Methodforward
(self, sequences_batch, sequences_lengths)
task3/layers.py:41
Methodforward
Args: premise_batch: A batch of sequences of vectors representing the premises in some NLI task. The batch is ass
task3/layers.py:63
Methodforward
Apply dropout to input tensor. Parameters ---------- input_tensor: ``torch.FloatTensor`` A tensor of shap
task3/model.py:14
Methodforward
Arguments: x {torch.Tensor} -- input tensor with shape [batch_size, seq_length]
task3/model.py:58
Methodforward
Arguments: x {torch.Tensor} -- input embeddings with shape [batch, seq_len, input_size] Returns: output {torc
task3/model.py:75
next →1–100 of 123, ranked by callers