MCPcopy Create free account

hub / github.com/hankcs/HanLP / functions

Functions2,968 in github.com/hankcs/HanLP

↓ 1 callersMethodprediction_to_human
(self, pred, vocab, batch)
hanlp/components/ner/transformer_ner.py:117
↓ 1 callersMethodprediction_to_human
(self, outputs: dict, batch)
hanlp/components/parsers/ud/ud_parser.py:325
↓ 1 callersMethodprediction_to_result
(token, prediction, predictions: List, ret_tokens: Union[bool, str])
hanlp/components/ner/biaffine_ner/biaffine_ner.py:253
↓ 1 callersMethodprediction_to_result
(self, prediction: List, batch: Dict[str, Any], delimiter=None)
hanlp/components/srl/span_bio/span_bio.py:374
↓ 1 callersMethodprediction_to_result
(self, prediction: Dict[str, Any], batch: Dict[str, Any])
hanlp/components/mtl/tasks/__init__.py:194
↓ 1 callersMethodprettyPrint
(Object object)
plugins/hanlp_restful_java/src/test/java/com/hankcs/hanlp/restful/MeaningRepresentationTest.java:28
↓ 1 callersFunctionpretty_tree_horizontal
Print the dependency tree horizontally Args: arrows: _do_print_debug_info: (Default value = False) Returns:
plugins/hanlp_common/hanlp_common/visualization.py:26
↓ 1 callersMethodprint
(self, msg: str, color=True)
hanlp/utils/log_util.py:85
↓ 1 callersMethodprint
(self, msg, newline=False, erase=True, logger=None)
hanlp/utils/time_util.py:189
↓ 1 callersFunctionprint_sentence_to_conll
Print a labeled sentence into CoNLL format. Args: fout: tokens: labels: Returns:
hanlp/components/srl/span_rank/srl_eval_utils.py:225
↓ 1 callersMethodratio
(self)
hanlp/utils/time_util.py:81
↓ 1 callersFunctionread_gold_predicates
(gold_path)
hanlp/components/srl/span_rank/srl_eval_utils.py:247
↓ 1 callersFunctionread_raw_amr_data
( paths: List[Union[str, Path]], use_recategorization=False, dereify=True, rem
hanlp/components/amr/seq2seq/dataset/IO.py:7
↓ 1 callersFunctionread_raw_amr_data
code for loading AMR from a set of files - use_recategorization: use graph recategorization trick - dereify: Dereify edges in g that
hanlp/components/amr/amrbart/preprocess/amr_io.py:31
↓ 1 callersMethodread_until_yieldable
Read in additional chunks until it is yieldable.
hanlp/utils/file_read_backwards/buffer_work_space.py:85
↓ 1 callersFunctionrecall_score
Compute the recall. The recall is the ratio ``tp / (tp + fn)`` where ``tp`` is the number of true positives and ``fn`` the number of fals
hanlp/metrics/chunking/sequence_labeling.py:254
↓ 1 callersMethodremove_attribute
(self, attr, value)
plugins/hanlp_common/hanlp_common/amr.py:250
↓ 1 callersMethodremove_redundant_edges
Edge labels such as ARGx, ARGx-of, and 'opx' should only appear at most once in each node's outgoing edges.
plugins/hanlp_common/hanlp_common/amr.py:904
↓ 1 callersMethodremove_subtree
(self, root)
plugins/hanlp_common/hanlp_common/amr.py:463
↓ 1 callersFunctionremove_unconnected_components
(concept: List, edge: List)
hanlp/datasets/parsing/amr.py:316
↓ 1 callersMethodremove_unknown_nodes
(self)
plugins/hanlp_common/hanlp_common/amr.py:890
↓ 1 callersFunctionrender_arrows
(lines)
plugins/hanlp_common/hanlp_common/visualization.py:127
↓ 1 callersMethodreplace_attribute
(self, attr, old, new)
plugins/hanlp_common/hanlp_common/amr.py:256
↓ 1 callersFunctionreplace_label
(full_label, new_label)
hanlp/utils/span_util.py:593
↓ 1 callersMethodreplace_span
(self, indexes, new, pos=None, ner=None)
plugins/hanlp_common/hanlp_common/amr.py:131
↓ 1 callersMethodreport
(self)
hanlp/metrics/chunking/chunking_f1.py:104
↓ 1 callersMethodreport_metrics
(self, loss)
hanlp/components/amr/seq2seq/seq2seq_amr_parser.py:206
↓ 1 callersFunctionreport_time_delta
(seconds, human=True)
hanlp/utils/time_util.py:41
↓ 1 callersMethodreset
(self)
hanlp/metrics/accuracy.py:215
↓ 1 callersMethodreset
(self, eps=1e-12)
hanlp/metrics/parsing/span.py:35
↓ 1 callersMethodreset_dropout_layer
(self, batch_size)
hanlp/components/srl/span_rank/highway_variational_lstm.py:47
↓ 1 callersMethodreset_dropout_layer
(self, batch_size)
hanlp/components/srl/span_rank/highway_variational_lstm.py:166
↓ 1 callersMethodreset_parameters
(self)
hanlp/components/taggers/rnn/rnntaggingmodel.py:74
↓ 1 callersMethodreset_parameters
(self)
hanlp/components/parsers/biaffine/variationalbilstm.py:96
↓ 1 callersMethodreset_parameters
(self)
hanlp/components/parsers/biaffine/biaffine.py:74
↓ 1 callersMethodreset_parameters
(self)
hanlp/components/parsers/biaffine/mlp.py:64
↓ 1 callersMethodreset_parameters
(self)
hanlp/components/srl/span_rank/span_ranking_srl_model.py:66
↓ 1 callersMethodreset_parameters
(self)
hanlp/components/srl/span_rank/highway_variational_lstm.py:158
↓ 1 callersMethodreset_parameters
(self)
hanlp/components/srl/span_rank/layer.py:128
↓ 1 callersMethodreset_parameters
(self)
hanlp/components/srl/span_rank/layer.py:149
↓ 1 callersMethodreset_parameters
(self)
hanlp/components/srl/span_rank/layer.py:194
↓ 1 callersMethodreset_parameters
(self)
hanlp/components/srl/span_rank/layer.py:233
↓ 1 callersMethodreset_parameters
(self)
hanlp/components/srl/span_rank/layer.py:301
↓ 1 callersMethodreset_parameters
Initialize the transition parameters. The parameters will be initialized randomly from a uniform distribution between -0.1 and 0.1.
hanlp/layers/crf/crf.py:69
↓ 1 callersMethodreset_state
(self, batch_size)
hanlp/components/srl/span_rank/highway_variational_lstm.py:174
↓ 1 callersMethodreset_state
(self)
hanlp/metrics/chunking/chunking_f1.py:47
↓ 1 callersMethodreset_state
(self)
hanlp/metrics/chunking/conlleval.py:72
↓ 1 callersMethodresolve_tasks
(self, tasks, skip_tasks)
hanlp/components/mtl/multi_task_learning.py:570
↓ 1 callersFunctionrestore_from_sliding_window
(all_encoder_layers, batch_size, max_pieces, full_seq_len, start_tokens, end_tokens)
hanlp/layers/transformers/utils.py:227
↓ 1 callersMethodresult
(self)
hanlp/metrics/chunking/iobes_tf.py:24
↓ 1 callersMethodresult
(self)
hanlp/metrics/chunking/bmes_tf.py:34
↓ 1 callersMethodreturn_line
Args: Returns: Precondition: self.yieldable() must be True
hanlp/utils/file_read_backwards/buffer_work_space.py:60
↓ 1 callersFunctionrole_is_reverted
(role: str)
hanlp/components/amr/seq2seq/dataset/penman.py:77
↓ 1 callersMethodrun_transformer
(self, input_ids, input_mask, prefix_offset)
hanlp/components/parsers/biaffine_tf/model.py:130
↓ 1 callersMethodsave
(self, filepath)
hanlp/components/pipeline.py:167
↓ 1 callersMethodsave
(self, save_dir: str, **kwargs)
hanlp/common/keras_component.py:205
↓ 1 callersMethodsave_meta
(self, save_dir, filename='meta.json', **kwargs)
hanlp/common/keras_component.py:149
↓ 1 callersMethodsave_weights
Save model weights to a directory. Args: save_dir: The directory to save weights into. filename: A file name for weig
hanlp/common/torch_component.py:72
↓ 1 callersMethodsentence_iterator
An iterator over the sentences in an individual CONLL formatted file.
hanlp/datasets/srl/loaders/ontonotes_loader.py:232
↓ 1 callersFunctionseparate_edges_nodes
(edges_nodes_slice, *other)
hanlp/components/amr/seq2seq/dataset/postprocessing.py:378
↓ 1 callersFunctionseparate_edges_nodes
(edges_nodes_slice, *other)
hanlp/components/amr/amrbart/common/postprocessing.py:253
↓ 1 callersFunctionsequence_cross_entropy
(log_probs: torch.FloatTensor, targets: torch.LongTensor,
hanlp/components/parsers/ud/udify_util.py:64
↓ 1 callersFunctionsequence_cross_entropy_with_logits
Computes the cross entropy loss of a sequence, weighted with respect to some user provided weights. Note that the weighting here is not the same a
hanlp/components/parsers/ud/udify_util.py:109
↓ 1 callersMethodserve
(self, export_dir=None, grpc_port=8500, rest_api_port=0, overwrite=False, dry_run=False)
hanlp/common/keras_component.py:508
↓ 1 callersFunctionset_gpu
Restrict TensorFlow to only use the GPU of idx Args: idx: (Default value = 0) Returns:
hanlp/utils/tf_util.py:15
↓ 1 callersFunctionset_gpu_memory_growth
(growth=True)
hanlp/utils/tf_util.py:42
↓ 1 callersFunctionset_seed
Copied from https://github.com/huggingface/transformers/blob/7b75aa9fa55bee577e2c7403301ed31103125a35/src/transformers/trainer.py#L76 Args:
hanlp/utils/torch_util.py:89
↓ 1 callersFunctionset_seed_tf
(seed=233)
hanlp/utils/tf_util.py:124
↓ 1 callersFunctionset_tf_loglevel
(level=logging.ERROR)
hanlp/utils/tf_util.py:68
↓ 1 callersFunctionset_tuple_with
(t: Tuple, v, at=0)
plugins/hanlp_common/hanlp_common/util.py:39
↓ 1 callersMethodshould_load_file
Determines whether data is a filepath. Args: data: Data to check. Returns: ``True`` to indicate it's a filepath.
hanlp/common/dataset.py:166
↓ 1 callersFunctionshow_colors
()
hanlp/utils/log_util.py:168
↓ 1 callersFunctionsize_of_dataset
(dataset: tf.data.Dataset)
hanlp/utils/tf_util.py:93
↓ 1 callersMethodsort_edges
(self, edges)
plugins/hanlp_common/hanlp_common/amr.py:526
↓ 1 callersFunctionspearman_correlation
Compute correlation between 2 1-D vectors. Adopted from https://discuss.pytorch.org/t/spearmans-correlation/91931/5 Args: x: Shape (N
hanlp/metrics/spearman_correlation.py:16
↓ 1 callersMethodsplit_batch
A handy method to perform longest-prefix-matching on a batch of sentences. It tokenize each sentence, record the chunks being either a key in
plugins/hanlp_trie/hanlp_trie/dictionary.py:68
↓ 1 callersFunctionsplit_by_dic
(text: str)
plugins/hanlp_demo/hanlp_demo/zh/tf/demo_cws.py:18
↓ 1 callersFunctionsplit_chtb
(chtbs: List[str], splits=None)
hanlp/datasets/parsing/loaders/_ctb_utils.py:218
↓ 1 callersFunctionsplit_file
(filepath, train=0.8, dev=0.1, test=0.1, names=None, shuffle=False)
hanlp/utils/io_util.py:485
↓ 1 callersFunctionsplit_long_sent
(sent, delimiters, max_seq_length)
hanlp/utils/string_util.py:78
↓ 1 callersFunctionsplit_sents
(text: str, trie: Trie)
plugins/hanlp_demo/hanlp_demo/zh/tf/demo_cws_trie.py:16
↓ 1 callersFunctionsplit_str_to_trees
(text: str)
hanlp/datasets/parsing/loaders/_ctb_utils.py:144
↓ 1 callersFunctionsplit_to_sliding_window
(input_ids, max_pieces)
hanlp/layers/transformers/utils.py:215
↓ 1 callersFunctionsrl_decode
(sentence_lengths, predict_dict, srl_labels_inv, config)
hanlp/components/srl/span_rank/inference_utils.py:212
↓ 1 callersFunctionstart_of_chunk
Checks if a chunk started between the previous and current word. Args: prev_tag: previous chunk tag. tag: current chunk tag. pr
hanlp/metrics/chunking/sequence_labeling.py:114
↓ 1 callersFunctionstr_tensor_2d_to_list
(str_tensor: tf.Tensor, pad=PAD)
hanlp/utils/tf_util.py:181
↓ 1 callersMethodstrongconnect
Args: v: index: stack: Returns:
hanlp/components/parsers/parse_alg.py:41
↓ 1 callersMethodstrongconnect
Args: v: index: stack: Returns:
hanlp/components/parsers/alg_tf.py:121
↓ 1 callersMethodstrongconnect
Args: v: index: stack: Returns:
hanlp/components/parsers/biaffine_tf/alg.py:121
↓ 1 callersFunctionsubtoken_offsets_to_subtokens
(text, token_subtoken_offsets)
hanlp/datasets/tokenization/loaders/txt.py:117
↓ 1 callersFunctionsubtokens_group_to_subtokens
(tokens, subtoken_offsets_group)
hanlp/datasets/tokenization/loaders/txt.py:124
↓ 1 callersMethodsummarize_vocabs
(self, logger=None, header='Vocab summary:')
hanlp/common/transform_tf.py:222
↓ 1 callersFunctionsummary_of_model
https://stackoverflow.com/a/53668338/3730690 Args: model: tf.keras.Model: Returns:
hanlp/utils/tf_util.py:100
↓ 1 callersFunctiontarjan
Adopted from Timothy Dozat https://github.com/tdozat/Parser/blob/master/lib/models/nn.py Args: parse_probs(NDArray): seq_len x seq_len, the
hanlp/components/parsers/alg_tf.py:174
↓ 1 callersFunctiontempdir_human
()
hanlp/utils/io_util.py:89
↓ 1 callersMethodtensorize
(raw_batch: Dict[str, Any], vocabs: VocabDict, pad_dict: Dict[str, int] = None, device=None)
hanlp/common/dataset.py:434
↓ 1 callersMethodtext_classification
Text classification is the task of assigning a sentence or document an appropriate category. The categories depend on the chosen data
plugins/hanlp_restful/hanlp_restful/__init__.py:504
↓ 1 callersMethodtext_to_instance
( self, # type: ignore sentences: List[List[str]], gold_clusters: Optiona
hanlp/datasets/coref/loaders/conll12coref.py:77
↓ 1 callersFunctionto_bioul
Given a tag sequence encoded with IOB1 labels, recode to BIOUL. In the IOB1 scheme, I is a token inside a span, O is a token outside a s
hanlp/utils/span_util.py:567
↓ 1 callersMethodto_conll
Convert to :class:`~hanlp_common.conll.CoNLLSentence`. Args: tok (str): Field name for tok. lem (str): Field
plugins/hanlp_common/hanlp_common/document.py:132
← previousnext →1,101–1,200 of 2,968, ranked by callers