Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/XingyanLee/Chinese-NER
/ functions
Functions
86 in github.com/XingyanLee/Chinese-NER
⨍
Functions
86
◇
Types & classes
9
↓ 5 callers
Function
extract
(sentence,tags)
src/utils.py:143
↓ 4 callers
Method
run_step
:param sess: session to run the batch :param is_train: a flag indicate if it is a train batch :param batch: a dict containing
src/model.py:462
↓ 3 callers
Method
create_mapping
Create a mapping (item to ID / ID to item) from a dictionary. Items are ordered by decreasing frequency.
src/Helper.py:48
↓ 3 callers
Function
evaluate
(iterable, options=None)
src/conlleval.py:62
↓ 3 callers
Method
load_sentences
Load sentences. A line must contain at least a word and its tag. Sentences are separated by empty lines.
src/Helper.py:305
↓ 3 callers
Method
prepare_dataset
Prepare the dataset. Return a list of lists of dictionaries containing: - word indexes - word char indexes
src/Helper.py:389
↓ 3 callers
Method
update_tag_scheme
Check and update sentences tagging scheme to IOB2. Only IOB1 and IOB2 schemes are accepted.
src/Helper.py:339
↓ 2 callers
Function
calculate_metrics
(correct, guessed, total)
src/conlleval.py:150
↓ 2 callers
Method
char_mapping
Create a dictionary and a mapping of words, sorted by frequency.
src/Helper.py:363
↓ 2 callers
Method
create_dico
Create a dictionary of items from a list of list of items.
src/Helper.py:33
↓ 2 callers
Method
create_model
(self)
src/SeqLabeling.py:55
↓ 2 callers
Method
decode
:param logits: [batch_size, num_steps, num_tags]float32, logits :param lengths: [batch_size]int32, real length of each sequence
src/model.py:484
↓ 2 callers
Function
end_of_chunk
(prev_tag, tag, prev_type, type_)
src/conlleval.py:231
↓ 2 callers
Method
evaluate
(self, name)
src/SeqLabeling.py:102
↓ 2 callers
Method
evaluate_line
(self,sentence,rettype='NER')
src/SeqLabeling.py:136
↓ 2 callers
Method
get_seg_features
Segment text with jieba features are represented in bies format s donates single word
src/Helper.py:147
↓ 2 callers
Method
iobes_iob
IOBES -> IOB
src/Helper.py:113
↓ 2 callers
Method
iter_batch
(self, shuffle=False)
src/Helper.py:500
↓ 2 callers
Method
load_config
Load configuration of the model parameters are stored in json format
src/Arguments.py:116
↓ 2 callers
Function
metrics
(counts)
src/conlleval.py:158
↓ 2 callers
Function
parse_args
(argv)
src/conlleval.py:40
↓ 2 callers
Function
parse_tag
(t)
src/conlleval.py:57
↓ 2 callers
Function
start_of_chunk
(prev_tag, tag, prev_type, type_)
src/conlleval.py:256
↓ 1 callers
Method
IDCNN_layer
:param idcnn_inputs: [batch_size, num_steps, emb_size] :return: [batch_size, num_steps, cnn_output_width]
src/model.py:234
↓ 1 callers
Method
augment_with_pretrained
Augment the dictionary with words that have a pretrained embedding. If `words` is None, we add every word that has a pretrained embed
src/Helper.py:416
↓ 1 callers
Method
biLSTM_layer
:param lstm_inputs: [batch_size, num_steps, emb_size] :return: [batch_size, num_steps, 2*lstm_dim]
src/model.py:204
↓ 1 callers
Function
clean
Clean current folder remove saved model and training log
src/utils.py:85
↓ 1 callers
Method
config_model
(self,char_to_id,tag_to_id)
src/Arguments.py:76
↓ 1 callers
Method
create_batch
(self,batch_size)
src/Helper.py:566
↓ 1 callers
Method
create_feed_dict
:param is_train: Flag, True for train batch :param batch: list train/evaluate data :return: structured data to feed
src/model.py:443
↓ 1 callers
Method
create_helper
(self,helper=None)
src/SeqLabeling.py:20
↓ 1 callers
Method
create_maps
(self,map_file=None,lower=False)
src/Helper.py:530
↓ 1 callers
Method
embedding_layer
:param char_inputs: one-hot encoding of sentence :param seg_inputs: segmentation feature :param config: wither use segmentati
src/model.py:179
↓ 1 callers
Method
full_to_half
Convert full-width character to half-width one
src/Helper.py:228
↓ 1 callers
Function
get_logger
(log_file)
src/utils.py:15
↓ 1 callers
Method
input_from_line
Take sentence data and return an input for the training or the evaluation function.
src/Helper.py:286
↓ 1 callers
Method
iob2
Check that tags have a valid IOB format. Tags in IOB1 format are converted to IOB2.
src/Helper.py:66
↓ 1 callers
Method
iob_iobes
IOB -> IOBES
src/Helper.py:88
↓ 1 callers
Method
load_dev
(self, dev_file, lower, zeros)
src/Helper.py:511
↓ 1 callers
Method
load_pretrained_emb
(self,emb_file)
src/Helper.py:527
↓ 1 callers
Method
load_test
(self, test_file, lower, zeros)
src/Helper.py:514
↓ 1 callers
Method
load_train
(self, train_file, lower, zeros)
src/Helper.py:508
↓ 1 callers
Method
load_word2vec
Load word embedding from pre-trained file embedding size must match
src/Helper.py:178
↓ 1 callers
Method
loss_layer
calculate crf loss :param project_logits: [1, num_steps, num_tags] :return: scalar loss
src/model.py:345
↓ 1 callers
Method
lstm_decode_layer
calculate lstm decode loss :param project_logits: :param lengths: :param name: :return: loss
src/model.py:373
↓ 1 callers
Method
lstm_decode_loss_layer
(self, lstm_outputs,bias,name=None)
src/model.py:426
↓ 1 callers
Function
main
(argv)
src/conlleval.py:287
↓ 1 callers
Function
make_path
Make folders for training and evaluation
src/utils.py:71
↓ 1 callers
Method
normalize
(self,inputs, epsilon = 1e-8,scope="ln",reuse=None)
src/model.py:141
↓ 1 callers
Method
pad_data
(data)
src/Helper.py:485
↓ 1 callers
Method
print_config
Print configuration of the model
src/Arguments.py:100
↓ 1 callers
Method
project_layer_bilstm
hidden layer between lstm layer and logits :param lstm_outputs: [batch_size, num_steps, emb_size] :return: [batch_size, num_
src/model.py:297
↓ 1 callers
Method
project_layer_idcnn
:param lstm_outputs: [batch_size, num_steps, emb_size] :return: [batch_size, num_steps, num_tags]
src/model.py:327
↓ 1 callers
Method
replace_html
(s)
src/Helper.py:273
↓ 1 callers
Function
report
(counts, out=None)
src/conlleval.py:171
↓ 1 callers
Function
report_notprint
(counts, out=None)
src/conlleval.py:197
↓ 1 callers
Method
restore_model
(self)
src/SeqLabeling.py:126
↓ 1 callers
Function
return_report
(input_file)
src/conlleval.py:281
↓ 1 callers
Method
save_config
Save configuration of the model parameters are stored in json format
src/Arguments.py:107
↓ 1 callers
Method
save_model
(self)
src/SeqLabeling.py:51
↓ 1 callers
Method
sort_and_pad
(self, data, batch_size)
src/Helper.py:476
↓ 1 callers
Method
tag_mapping
Create a dictionary and a mapping of tags, sorted by frequency.
src/Helper.py:378
↓ 1 callers
Function
test_ner
Run perl script to evaluate model
src/utils.py:53
↓ 1 callers
Method
tf_apps
(self,FLAGS)
src/Arguments.py:51
↓ 1 callers
Method
train
(self)
src/SeqLabeling.py:71
↓ 1 callers
Function
uniq
(iterable)
src/conlleval.py:145
↓ 1 callers
Method
zero_digits
Replace every digit in a string by a zero.
src/Helper.py:59
Method
__init__
(self)
src/Arguments.py:15
Method
__init__
(self)
src/conlleval.py:27
Method
__init__
(self,args)
src/SeqLabeling.py:13
Method
__init__
(self, data, batch_size)
src/Helper.py:472
Method
__init__
(self, config ,graph)
src/model.py:14
Method
body
(i,state,outputs)
src/model.py:392
Function
convert_to_text
Convert conll data to text
src/utils.py:120
Method
create_input
Take sentence data and return an input for the training or the evaluation function.
src/Helper.py:166
Method
cut_to_sentence
Cut text to sentences
src/Helper.py:244
Method
dicts
(self,dicts)
src/Arguments.py:63
Method
evaluate
:param sess: session to run the model :param data: list of data :param id_to_tag: index to tag name :return: evalua
src/model.py:505
Method
evaluate_line
(self, sess, inputs, id_to_tag)
src/model.py:539
Method
f
(x)
src/Helper.py:398
Method
insert_singletons
Replace singletons by the unknown word with a probability p.
src/Helper.py:134
Method
load_maps
Load mappings from the file
src/Helper.py:462
Function
main
(_)
src/main.py:83
Method
save_maps
Save mappings and invert mappings
src/Helper.py:453
Method
select_tag_schema
tags classes can switch (IOB / IOBES) :param tags: :return:
src/Helper.py:517
Method
self_attention
(self,keys, scope='multihead_attention', reuse=None)
src/model.py:152