MCPcopy Create free account

hub / github.com/hankcs/HanLP / functions

Functions2,968 in github.com/hankcs/HanLP

↓ 2 callersMethodpost_outputs
(self, predictions, data, order, use_pos, build_data, conll=True)
hanlp/components/parsers/biaffine/biaffine_dep.py:100
↓ 2 callersMethodpredict_amrs
(self, batch, beam_size=1)
hanlp/components/amr/seq2seq/seq2seq_amr_parser.py:259
↓ 2 callersMethodpredict_batch
(self, batch, num_beams, max_length)
hanlp/components/amr/amrbart/bart_amr_parser.py:106
↓ 2 callersMethodpredict_task
(self, task: Task, output_key, batch, results, output_dict=None, run_transform=True, cls_
hanlp/components/mtl/multi_task_learning.py:593
↓ 2 callersMethodpredictions_to_human
(self, predictions, outputs, data, use_pos, conll=True)
hanlp/components/parsers/biaffine/biaffine_dep.py:108
↓ 2 callersFunctionprint_to_conll
(sentences, srl_labels, output_filename, gold_predicates=None)
hanlp/components/srl/span_rank/srl_eval_utils.py:262
↓ 2 callersFunctionremove_all_ec
Remove empty categories for all trees in this file and save them into a "noempty" file. Args: path: File path.
hanlp/datasets/parsing/loaders/_ctb_utils.py:310
↓ 2 callersMethodremove_node_attribute
(self, node, attr, value)
plugins/hanlp_common/hanlp_common/amr.py:444
↓ 2 callersFunctionrender_span
(begin, end, unidirectional=False)
plugins/hanlp_common/hanlp_common/visualization.py:145
↓ 2 callersFunctionreport
(counts, out=None)
hanlp/metrics/chunking/conlleval.py:265
↓ 2 callersMethodreport
(self, human=True)
hanlp/utils/time_util.py:54
↓ 2 callersMethodreport_metrics
(self, loss, metrics)
hanlp/components/ner/biaffine_ner/biaffine_ner.py:353
↓ 2 callersMethodreport_metrics
(self, loss, metric)
hanlp/components/sts/transformer_sts.py:241
↓ 2 callersMethodreport_metrics
(self, loss, metrics)
hanlp/components/srl/span_rank/span_rank.py:375
↓ 2 callersMethodreport_metrics
(self, loss, metrics)
hanlp/components/eos/ngram.py:300
↓ 2 callersMethodreset_metrics
(self, metrics)
hanlp/components/ner/biaffine_ner/biaffine_ner.py:350
↓ 2 callersMethodreset_metrics
(self, metrics)
hanlp/components/srl/span_rank/span_rank.py:371
↓ 2 callersMethodreset_metrics
(self, metrics)
hanlp/components/eos/ngram.py:297
↓ 2 callersMethodreset_metrics
(metrics: Dict[str, Metric])
hanlp/components/mtl/multi_task_learning.py:669
↓ 2 callersMethodrun_lm
(self, lm, ids: torch.Tensor, offsets: torch.LongTensor)
hanlp/layers/embeddings/contextual_string_embedding.py:97
↓ 2 callersMethodrun_metrics
(self, arcs, rels, arc_scores, rel_scores, words, mask, metric)
hanlp/components/parsers/biaffine_parser_tf.py:171
↓ 2 callersMethodrun_rnn
(self, embed, lens, seq_len)
hanlp/components/parsers/biaffine/biaffine_model.py:143
↓ 2 callersMethodsamples_to_dataset
(self, samples: Generator, map_x=None, map_y=None, batch_size=32, shuffle=None, repeat=None,
hanlp/common/transform_tf.py:162
↓ 2 callersMethodsamples_to_dataset
(self, samples: Generator, map_x=None, map_y=None, batch_size=5000, shuffle=None, repeat=None,
hanlp/transform/conll_tf.py:113
↓ 2 callersMethodsave
Save this component to a directory. Args: save_dir: The directory to save this component. **kwargs: Not used.
hanlp/common/torch_component.py:152
↓ 2 callersMethodsave
(self, path, fmt=None)
plugins/hanlp_common/hanlp_common/structure.py:13
↓ 2 callersMethodsave_config
(self, save_dir, filename='config.json')
hanlp/common/keras_component.py:160
↓ 2 callersMethodsave_pickle
Save to path Args: path: Returns:
plugins/hanlp_common/hanlp_common/structure.py:35
↓ 2 callersMethodsave_vocab
(self, save_dir, filename='vocab.json')
hanlp/common/transform.py:31
↓ 2 callersMethodsave_vocabs
Save vocabularies to a directory. Args: save_dir: The directory to save vocabularies. filename: The name for vocabul
hanlp/common/torch_component.py:131
↓ 2 callersMethodsave_vocabs
(self, save_dir, filename='vocabs.json')
hanlp/common/keras_component.py:176
↓ 2 callersMethodsave_weights
(self, save_dir, filename='model.h5')
hanlp/common/keras_component.py:167
↓ 2 callersMethodscale
r"""Scale down the ``batch_size`` and ``batch_max_tokens`` to :math:`\frac{1}{\text{gradient_accumulation}}` of them respectively. Ar
hanlp/common/dataset.py:754
↓ 2 callersFunctionsdp_eval
Modified from https://github.com/tdozat/Parser-v3/blob/2ff4061373e8aac8c962537a6220e1d5b196abf6/scripts/semdep_eval.py Dozat claimed "I tested it
hanlp/metrics/parsing/semdep_eval.py:28
↓ 2 callersFunctionseparate_concept_rel
(concept, prefix=REL)
hanlp/datasets/parsing/amr.py:306
↓ 2 callersFunctionshut_up_python_logging
()
hanlp/utils/tf_util.py:61
↓ 2 callersMethodsliding_window
(self, flat_wordpiece_ids, same_tail=True)
hanlp/transform/transformer_tokenizer.py:19
↓ 2 callersFunctionsmatch_eval
(pred, gold, use_fast=False)
hanlp/metrics/amr/smatch_eval.py:23
↓ 2 callersFunctionspace_tokenizer
For a given input `sentence`, return a list of its tokens. Split on Unicode spaces ``\\s+`` (i.e., any kind of **Unicode** space character).
hanlp/utils/lang/en/english_tokenizer.py:177
↓ 2 callersMethodspans_to_tokens
(self, spans, batch, rebuild_span=False)
hanlp/components/tokenizers/transformer.py:174
↓ 2 callersFunctionsplit_dict
(batch: Dict[str, Any])
plugins/hanlp_common/hanlp_common/util.py:190
↓ 2 callersFunctionsplit_if_compressed
(path: str, compressed_ext=('.zip', '.tgz', '.gz', 'bz2', '.xz'))
hanlp/utils/io_util.py:273
↓ 2 callersFunctionsplit_tag
split chunk tag into IOBES prefix and chunk_type e.g. B-PER -> (B, PER) O -> (O, None) Args: chunk_tag: Returns:
hanlp/metrics/chunking/conlleval.py:134
↓ 2 callersFunctionstart_of_chunk
(prev_tag, tag, prev_type, type_)
hanlp/metrics/chunking/conlleval.py:309
↓ 2 callersMethodstop
(self)
hanlp/utils/time_util.py:219
↓ 2 callersFunctionstr_tensor_to_str
(str_tensor: tf.Tensor)
hanlp/utils/tf_util.py:177
↓ 2 callersMethodsubset
Create a subset given indices of samples. Args: indices: Indices of samples. Returns: TransformableDataset:
hanlp/common/dataset.py:265
↓ 2 callersFunctionsubtoken_to_tensor
(token_field, ret)
hanlp/datasets/parsing/amr.py:204
↓ 2 callersMethodtag_to_span
(self, batch_tags, batch)
hanlp/components/ner/transformer_ner.py:51
↓ 2 callersFunctiontarjan
r""" Tarjan algorithm for finding Strongly Connected Components (SCCs) of a graph. Args: sequence (list): List of head in
hanlp/components/parsers/alg.py:352
↓ 2 callersFunctiontemp_lock
(path)
hanlp/utils/io_util.py:93
↓ 2 callersFunctiontempdir
(name=None)
hanlp/utils/io_util.py:82
↓ 2 callersMethodtextClassification
Text classification is the task of assigning a sentence or document an appropriate category. The categories depend on the chosen dataset and can range
plugins/hanlp_restful_java/src/main/java/com/hankcs/hanlp/restful/HanLPClient.java:489
↓ 2 callersFunctiontf_bernoulli
(shape, p, dtype=None)
hanlp/utils/tf_util.py:173
↓ 2 callersMethodtoString
()
plugins/hanlp_restful_java/src/main/java/com/hankcs/hanlp/restful/Span.java:59
↓ 2 callersMethodto_chars
(self, word: str)
hanlp/common/transform.py:391
↓ 2 callersMethodto_dict
(self)
plugins/hanlp_common/hanlp_common/structure.py:78
↓ 2 callersMethodto_pretty
Convert to a pretty text representation which can be printed to visualize linguistic structures. Args: tok: Token key.
plugins/hanlp_common/hanlp_common/document.py:188
↓ 2 callersMethodto_tags
(self, y: tf.Tensor, sample_weight: tf.Tensor)
hanlp/metrics/chunking/chunking_f1_tf.py:42
↓ 2 callersFunctiontoken_processing
(tok)
hanlp/components/amr/seq2seq/dataset/postprocessing.py:15
↓ 2 callersMethodtokenize_amr
(self, graph)
hanlp/components/amr/seq2seq/dataset/tokenization_bart.py:125
↓ 2 callersMethodtokenize_amr
(self, graph)
hanlp/components/amr/seq2seq/dataset/tokenization_t5.py:114
↓ 2 callersMethodtokenize_func
(self)
hanlp/transform/text_tf.py:26
↓ 2 callersFunctiontrack
(tree, i)
hanlp/datasets/parsing/loaders/constituency_dataset.py:144
↓ 2 callersMethodtransform_sample
Apply transforms to a sample. Args: sample: A sample, which is a ``dict`` holding features. inplace: ``True`` to appl
hanlp/common/dataset.py:87
↓ 2 callersFunctiontransformer_encode
Run transformer and pool its outputs. Args: transformer: A transformer model. input_ids: Indices of subwords. attention_m
hanlp/layers/transformers/utils.py:14
↓ 2 callersFunctiontransformer_sliding_window
Args: transformer: input_ids: torch.LongTensor: input_mask: (Default value = None) offsets: torch.LongTensor: (Defaul
hanlp/layers/transformers/utils.py:101
↓ 2 callersMethodtrim
(self, min_frequency)
hanlp/common/vocab.py:451
↓ 2 callersMethodunpack
(batch, mask=None, training=False)
hanlp/components/srl/span_rank/span_ranking_srl_model.py:500
↓ 2 callersMethodunpack_scores
(self, arc_scores, rel_scores)
hanlp/components/parsers/biaffine/biaffine_2nd_dep.py:142
↓ 2 callersMethodupdate_metric
(self, metric, logits: torch.Tensor, target, output=None)
hanlp/components/classifiers/transformer_classifier.py:191
↓ 2 callersMethodupdate_metrics
(self, batch: dict, prediction: Union[Dict, List], metrics)
hanlp/components/ner/biaffine_ner/biaffine_ner.py:361
↓ 2 callersMethodupdate_metrics
(self, metric, batch, prediction)
hanlp/components/parsers/constituency/crf_constituency_parser.py:142
↓ 2 callersMethodupdate_metrics
(self, metrics, batch, outputs, mask)
hanlp/components/parsers/ud/ud_parser.py:291
↓ 2 callersMethodupdate_metrics
(self, batch: dict, output_dict: dict, metrics)
hanlp/components/srl/span_rank/span_rank.py:410
↓ 2 callersMethodupdate_metrics
(self, metric, prediction, batch)
hanlp/components/srl/span_bio/span_bio.py:196
↓ 2 callersMethodupdate_metrics
(self, batch: dict, prediction: torch.FloatTensor, metrics)
hanlp/components/eos/ngram.py:303
↓ 2 callersMethodupdate_metrics
(self, batch: Dict[str, Any], output_dict: Dict[str, Any], metrics: MetricDict, task_name)
hanlp/components/mtl/multi_task_learning.py:739
↓ 2 callersMethodupdate_state
(self, true_seqs: List[str], pred_seqs: List[str])
hanlp/metrics/chunking/conlleval.py:75
↓ 2 callersMethodupdate_the_state
(self, y_true: tf.Tensor, y_pred: tf.Tensor, sample_weight: tf.Tensor = None, **kwargs)
hanlp/metrics/chunking/chunking_f1_tf.py:18
↓ 2 callersFunctionwrite_predictions
(predictions_path, tokenizer, graphs)
hanlp/components/amr/seq2seq/evaluation.py:6
↓ 2 callersMethodx_to_idx
(self, x)
hanlp/common/transform_tf.py:210
↓ 2 callersMethody_to_idx
(self, y)
hanlp/common/transform_tf.py:214
↓ 2 callersMethodyieldable
hanlp/utils/file_read_backwards/buffer_work_space.py:45
↓ 1 callersMethodX_to_inputs
(self, X: Union[tf.Tensor, Tuple[tf.Tensor]])
hanlp/components/taggers/cnn_tagger_tf.py:55
↓ 1 callersMethodX_to_inputs
(self, X: Union[tf.Tensor, Tuple[tf.Tensor]])
hanlp/transform/conll_tf.py:48
↓ 1 callersMethodY_to_outputs
(self, Y: Union[tf.Tensor, Tuple[tf.Tensor]], gold=False, inputs=None, X=None, **kwargs)
hanlp/components/tokenizers/tok_tf.py:44
↓ 1 callersMethodY_to_outputs
(self, Y: Union[tf.Tensor, Tuple[tf.Tensor]], gold=False, inputs=None, X=None)
hanlp/transform/conll_tf.py:778
↓ 1 callersMethodY_to_tokens
(self, tag_vocab, Y, gold, inputs)
hanlp/components/tokenizers/tok_tf.py:80
↓ 1 callersMethodY_to_tokens
(self, tag_vocab, Y, gold, inputs)
hanlp/transform/txt_tf.py:196
↓ 1 callersMethod__call__
(self, pred_tags: torch.LongTensor, gold_tags: torch.LongTensor, lens: List[int] = None)
hanlp/metrics/chunking/binary_chunking_f1.py:13
↓ 1 callersMethod__call__
(self, sample: dict)
hanlp/layers/embeddings/fast_text.py:39
↓ 1 callersMethod__copy__
(self)
hanlp/components/pipeline.py:152
↓ 1 callersMethod__getitem__
(self, k: str)
hanlp/common/transform.py:200
↓ 1 callersMethod__getitem__
(self, key)
plugins/hanlp_trie/hanlp_trie/trie.py:72
↓ 1 callersMethod__init__
(self, component: Component, input_key: str = None, output_key: str = None, **kwargs)
hanlp/components/pipeline.py:17
↓ 1 callersMethod__init__
(self, *args, use_pointer_tokens=False, collapse_name_ops=False, INIT='Ġ', **kwargs)
hanlp/components/amr/seq2seq/dataset/tokenization_bart.py:24
↓ 1 callersMethod__init__
(self, *args, use_pointer_tokens=False, collapse_name_ops=False, INIT='', **kwargs)
hanlp/components/amr/seq2seq/dataset/tokenization_t5.py:25
↓ 1 callersMethod__init__
(self, transform: WindowTokenTransform = None)
hanlp/components/taggers/cnn_tagger_tf.py:95
↓ 1 callersMethod__init__
A simple tagger using a linear layer with an optional CRF (:cite:`lafferty2001conditional`) layer for any tagging tasks including PoS tagging
hanlp/components/taggers/transformers/transformer_tagger.py:69
← previousnext →501–600 of 2,968, ranked by callers