Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/Alic-yuan/nlp-beginner-finish
/ functions
Functions
123 in github.com/Alic-yuan/nlp-beginner-finish
⨍
Functions
123
◇
Types & classes
29
↓ 16 callers
Method
load
Load pre-trained embedding weights. Arguments: vectors {torch.Tensor} -- from "TEXT.vocab.vectors".
task3/model.py:51
↓ 7 callers
Method
__init__
Arguments: vector_size {int} -- word embedding size. vocab_size {int} -- the size of the vocabulary. hidd
task3/model.py:266
↓ 7 callers
Method
run
(self)
task5/train.py:59
↓ 4 callers
Method
init_hidden
(self, layer_num, batch_size)
task5/model.py:39
↓ 4 callers
Function
native_content
(content)
task2/cnews_loader.py:26
↓ 4 callers
Function
read_category
读取分类目录,固定
task2/cnews_loader.py:87
↓ 4 callers
Function
read_vocab
读取词汇表
task2/cnews_loader.py:77
↓ 3 callers
Function
batch_iter
生成批次数据
task2/cnews_loader.py:119
↓ 3 callers
Function
correct_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 callers
Function
get_tags
(path, tag, tag_map)
task4/utils.py:15
↓ 3 callers
Function
open_file
常用文件操作,可在python2和python3间切换. mode: 'r' or 'w' for read or write
task2/cnews_loader.py:33
↓ 3 callers
Function
process_file
将文件转换为id表示
task2/cnews_loader.py:103
↓ 2 callers
Method
batch_iter
迭代器,将数据分批传给模型
task1/datahelper/data_process.py:85
↓ 2 callers
Function
get_data
(config)
task5/dataHandler.py:154
↓ 2 callers
Method
log_likelihood
(self, x, tags)
task4/model/LSTM_CRF.py:39
↓ 2 callers
Function
masked_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 callers
Function
pad_sequences
pad_sequences 把序列长度转变为一样长的,如果设置了maxlen则长度统一为maxlen,如果没有设置则默认取 最大的长度。填充和截取包括两种方法,post与pre,post指从尾部开始处理,pre指从头部 开始处理,默认都是从尾部开始。 Argumen
task3/data.py:89
↓ 2 callers
Function
read_file
读取文件数据
task2/cnews_loader.py:44
↓ 2 callers
Method
train
(self)
task4/main.py:63
↓ 2 callers
Function
validate
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 callers
Function
weighted_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 callers
Method
__init__
(self)
task2/torch_model.py:14
↓ 1 callers
Function
build_vocab
(train_dir, vocab_size=5000)
task3/data.py:129
↓ 1 callers
Function
data2pkl
()
task4/data/data_renmin_word.py:66
↓ 1 callers
Function
evaluate
测试集上准曲率评估
task1/main.py:16
↓ 1 callers
Function
evaluate
测试集上准确率评估
task2/torch_train.py:15
↓ 1 callers
Function
f1_score
(tar_path, pre_path, tag, tag_map)
task4/utils.py:38
↓ 1 callers
Function
flat_gen
(x)
task4/data/data_renmin_word.py:94
↓ 1 callers
Function
format_result
(result, text, tag)
task4/utils.py:3
↓ 1 callers
Method
generate_head
生成藏头诗
task5/sample.py:71
↓ 1 callers
Method
generate_head_test
生成藏头诗
task5/train.py:90
↓ 1 callers
Method
generate_poetry
模式一:随机生成诗歌 模式二:生成藏头诗 模式三:给定首句生成诗 :return:
task5/sample.py:104
↓ 1 callers
Method
generate_random
自由生成一首诗歌
task5/sample.py:40
↓ 1 callers
Function
get_data
()
task1/main.py:30
↓ 1 callers
Method
get_tfidf
提取tfidf特征
task1/datahelper/data_process.py:61
↓ 1 callers
Function
get_time_dif
获取已经使用的时间
task1/main.py:9
↓ 1 callers
Function
handle_json
读入json文件,返回诗句list,每一个元素为一首诗歌(str类型表示)
task5/dataHandler.py:42
↓ 1 callers
Function
iselement
(e)
task4/data/data_renmin_word.py:95
↓ 1 callers
Method
load_data
(self)
task5/sample.py:23
↓ 1 callers
Method
load_model
(self)
task5/sample.py:28
↓ 1 callers
Function
load_sentences
(file, data_size=None)
task3/data.py:36
↓ 1 callers
Function
load_vocab
(vocab_file)
task3/data.py:60
↓ 1 callers
Method
lr
(self)
task1/lr_model.py:10
↓ 1 callers
Function
main
(train_file, dev_file, vocab_file, target_dir, max_length=50, hidden_size=300, drop
task3/train.py:9
↓ 1 callers
Function
open_file
常用文件操作,可在python2和python3间切换. mode: 'r' or 'w' for read or write
task3/data.py:27
↓ 1 callers
Function
originHandle
()
task4/data/data_renmin_word.py:9
↓ 1 callers
Function
originHandle2
()
task4/data/data_renmin_word.py:35
↓ 1 callers
Function
pad_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 callers
Function
parse_raw_data
获取原数据并预处理 :param data_path: 数据存放的路径 :param category: 数据的类型 :param author: 作者名称 :param constrain: 长度限制 :return: list ['床前明
task5/dataHandler.py:9
↓ 1 callers
Function
pre_data
分词去停用词
task1/predict.py:8
↓ 1 callers
Method
pre_data
数据预处理
task1/datahelper/data_process.py:34
↓ 1 callers
Method
predict
(self, message)
task2/torch_test.py:30
↓ 1 callers
Function
predict_line
预测结果
task1/predict.py:28
↓ 1 callers
Method
provide_data
提供数据
task1/datahelper/data_process.py:74
↓ 1 callers
Function
read_categories
读取类别
task1/predict.py:21
↓ 1 callers
Method
read_data
读取数据
task1/datahelper/data_process.py:18
↓ 1 callers
Method
save_categories
将文本的类别写到本地
task1/datahelper/data_process.py:29
↓ 1 callers
Function
sentence2split
()
task4/data/data_renmin_word.py:58
↓ 1 callers
Function
sentence_parse
对文本进行处理,取出脏数据
task5/dataHandler.py:22
↓ 1 callers
Function
sort_by_seq_lens
(batch, sequences_lengths, descending=True)
task3/utils.py:7
↓ 1 callers
Function
train
(X_train, X_test, y_train, y_test)
task1/main.py:39
↓ 1 callers
Function
train
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 callers
Function
train
()
task2/torch_train.py:47
↓ 1 callers
Method
train
(self, data_loader, model, optimizer, criterion, char_to_ix, ix_to_chars)
task5/train.py:20
↓ 1 callers
Function
word_index
(p_sentences, h_sentences, word2idx, max_char_len)
task3/data.py:46
Function
X_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
Function
build_vocab
根据训练集构建词汇表,存储
task2/cnews_loader.py:59
Method
forward
(self, x)
task4/model/LSTM_CRF.py:25
Method
forward
(self, x)
task4/model/LSTM.py:20
Method
forward
Apply dropout to the input batch of sequences. Args: sequences_batch: A batch of sequences of vectors that will serve
task3/layers.py:11
Method
forward
(self, sequences_batch, sequences_lengths)
task3/layers.py:41
Method
forward
Args: premise_batch: A batch of sequences of vectors representing the premises in some NLI task. The batch is ass
task3/layers.py:63
Method
forward
Apply dropout to input tensor. Parameters ---------- input_tensor: ``torch.FloatTensor`` A tensor of shap
task3/model.py:14
Method
forward
Arguments: x {torch.Tensor} -- input tensor with shape [batch_size, seq_length]
task3/model.py:58
Method
forward
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