MCPcopy Index your code

hub / github.com/hankcs/HanLP / functions

Functions2,968 in github.com/hankcs/HanLP

↓ 471 callersMethodappend
Append a pipe to the tail of this pipeline. Args: component: A callable function. input_key: The input key i
hanlp/components/pipeline.py:86
↓ 456 callersMethodappend
(self, item: Union[str, Tuple[str, Vocab], Tuple[str, str, Vocab], FieldToIndex])
hanlp/common/transform.py:74
↓ 269 callersMethodget
(_k, _i)
plugins/hanlp_common/hanlp_common/document.py:167
↓ 178 callersMethodsize
(self)
hanlp/layers/embeddings/word2vec_tf.py:76
↓ 143 callersMethodsplit
Split dataset into subsets. Args: *ratios: The ratios for each subset. They can be any type of numbers which will be normalized.
hanlp/common/dataset.py:223
↓ 142 callersMethoditems
(self)
hanlp/components/mtl/multi_task_learning.py:801
↓ 116 callersMethodextend
(self, tokens: Iterable[str])
hanlp/common/vocab.py:357
↓ 112 callersMethodadd
Tries to add a token into a vocab and returns its id. If it has already been there, its id will be returned and the vocab won't be updated. I
hanlp/common/vocab.py:75
↓ 88 callersFunctionget_resource
Fetch real (local) path for a resource (model, corpus, whatever) to ``save_dir``. Args: path: A local path (which will returned as is) or a
hanlp/utils/io_util.py:284
↓ 88 callersMethodload
(self, path, fmt=None)
plugins/hanlp_common/hanlp_common/structure.py:24
↓ 70 callersMethodupdate
Update the vocab with these tokens by adding them to vocab one by one. Args: tokens (Iterable[str]): A list of tokens.
hanlp/common/vocab.py:95
↓ 58 callersMethodlog
(self, info=None, ratio_percentage=True, ratio=True, step=1, interval=0.5, erase=True, logger: Uni
hanlp/utils/time_util.py:165
↓ 54 callersFunctionmerge_locals_kwargs
(locals: dict, kwargs: dict = None, excludes=('self', 'kwargs', '__class__'))
plugins/hanlp_common/hanlp_common/util.py:75
↓ 51 callersFunctioncdroot
cd to project root, so models are saved in the root folder
tests/__init__.py:9
↓ 51 callersMethodevaluate
Evaluate test set. Args: tst_data: Test set, which is usually a file path. save_dir: The directory to save evaluation
hanlp/common/torch_component.py:444
↓ 47 callersMethodto
Move this component to devices. Args: devices: Target devices. logger: Logger for printing progress report, as copyin
hanlp/common/torch_component.py:512
↓ 44 callersMethodfit
Build the vocabulary from training file Parameters ---------- trn_path : path to training set kwargs
hanlp/common/transform_tf.py:35
↓ 43 callersMethodput
Put names and corresponding :class:`hanlp.common.vocab.Vocab` instances into self. Args: **kwargs: Names and corresponding :class
hanlp/common/transform.py:220
↓ 42 callersMethodstep
(self, closure=None)
hanlp/components/amr/seq2seq/optim.py:32
↓ 42 callersFunctionstripe
r'''Returns a diagonal stripe of the tensor. Args: x: Tensor n: int w: int offset: tuple (Default value = (0) dim:
hanlp/components/parsers/alg.py:209
↓ 39 callersMethodlower
Convert all tokens to lower case. Returns: Itself.
hanlp/common/vocab.py:290
↓ 39 callersMethodpredict
(self, doc: Document, **kwargs)
hanlp/components/pipeline.py:33
↓ 32 callersMethodsqueeze
r""" Squeeze the dimension of each field into one. It's intended to convert a nested document like ``[[sent_i]]`` to ``[sent_i]``. Whe
plugins/hanlp_common/hanlp_common/document.py:478
↓ 31 callersFunctionflash
(line: str, color=True)
hanlp/utils/log_util.py:103
↓ 29 callersMethoditems
(self, ordered=False, prefix='')
plugins/hanlp_trie/hanlp_trie/trie.py:157
↓ 29 callersMethodshape
(self)
hanlp/layers/embeddings/word2vec_tf.py:86
↓ 27 callersMethodbuild
(self, input_shape)
hanlp/components/parsers/biaffine_tf/layers.py:19
↓ 27 callersMethodfrom_pretrained
(cls, pretrained_model_path, additional_tokens: Iterable[str] = None, recategorization
hanlp/components/amr/seq2seq/dataset/tokenization_t5.py:37
↓ 27 callersMethodinsert
Args: index: The index of the new pipe. input_key: The input key indicating which fields will be inputted to the pip
hanlp/components/pipeline.py:106
↓ 26 callersMethodappend_transform
Append a transform to its list of transforms. Args: transform: A new transform to be appended. Returns: Itse
hanlp/common/dataset.py:43
↓ 23 callersMethodlookup
(self, token_tensor: tf.Tensor)
hanlp/common/vocab_tf.py:189
↓ 21 callersFunctionmerge_dict
Merging the provided dict with other kvs Args: d: kwargs: d: dict: overwrite: (Default value = False) inplace:
plugins/hanlp_common/hanlp_common/util.py:53
↓ 21 callersMethodpost
(String api, Object input_)
plugins/hanlp_restful_java/src/main/java/com/hankcs/hanlp/restful/HanLPClient.java:571
↓ 20 callersMethodclose
(self)
hanlp/common/dataset.py:530
↓ 20 callersFunctionreorder
(samples: List, order: List[int])
plugins/hanlp_common/hanlp_common/util.py:199
↓ 19 callersMethoddim
(self)
hanlp/layers/embeddings/word2vec_tf.py:81
↓ 19 callersFunctioneprint
(*args, **kwargs)
plugins/hanlp_common/hanlp_common/io.py:40
↓ 19 callersFunctionget_entities
Gets entities from sequence. Args: seq(list): sequence of labels. suffix: (Default value = False) Returns: list: list of
hanlp/metrics/chunking/sequence_labeling.py:41
↓ 19 callersMethodget_idx
Get the idx of a token. If it's not there, it will be added to the vocab when the vocab is locked otherwise the id of UNK will be returned.
hanlp/common/vocab.py:105
↓ 19 callersMethodsave_weights
(self, save_dir, filename='model.h5')
hanlp/components/taggers/rnn_tagger_tf.py:50
↓ 19 callersMethodsplit
Like the :meth:`str.split`, this method splits a piece of text into chunks by taking the keys in this dictionary as delimiters. It performs lo
plugins/hanlp_trie/hanlp_trie/dictionary.py:28
↓ 18 callersMethodprettyPrint
(Object object)
plugins/hanlp_restful_java/src/test/java/com/hankcs/hanlp/restful/HanLPClientTest.java:187
↓ 18 callersMethodpretty_print
Print a pretty text representation which visualizes linguistic structures. Args: tok: Token key. lem: Lemma
plugins/hanlp_common/hanlp_common/document.py:408
↓ 18 callersMethodpurge_cache
Purges all cache. If cache is not enabled, this method enables it.
hanlp/common/dataset.py:218
↓ 16 callersFunctionclasspath_of
get the full class path of object Args: obj: return: Returns:
plugins/hanlp_common/hanlp_common/reflection.py:8
↓ 16 callersMethodlock
Lock this vocab up so that it won't accept new tokens. Returns: Itself.
hanlp/common/vocab.py:155
↓ 15 callersFunctioncprint
(*args, file=None, **kwargs)
hanlp/utils/log_util.py:141
↓ 15 callersMethodsummary
Get or print a summary of this vocab. Args: verbose: ``True`` to print the summary to stdout. Returns: Summa
hanlp/common/vocab.py:224
↓ 14 callersMethoddecode
(self, output_dict: Dict[str, torch.Tensor])
hanlp/components/parsers/ud/tag_decoder.py:109
↓ 14 callersMethodembed
(self, word: str)
hanlp/layers/embeddings/fast_text.py:48
↓ 14 callersMethodfrom_pretrained
(cls, pretrained_model_name_or_path, *model_args, training=True, **kwargs)
hanlp/layers/transformers/pt_imports.py:18
↓ 14 callersMethodreset
(self)
hanlp/metrics/f1.py:34
↓ 13 callersMethodbuild_dataset
(self, data, transform=None)
hanlp/components/tokenizers/tok.py:31
↓ 13 callersMethodbuild_vocabs
(self, dataset, logger)
hanlp/components/taggers/rnn_tagger.py:159
↓ 13 callersMethodcompute_lens
Args: data: Samples to be measured or path to dataset during training time. dataset: During training time, use this
hanlp/components/mtl/tasks/__init__.py:151
↓ 13 callersMethodfind
(self, x)
hanlp/components/parsers/parse_alg.py:101
↓ 13 callersFunctionprefix_match
(target, sources: Iterable[str])
plugins/hanlp_common/hanlp_common/util.py:241
↓ 12 callersMethod__init__
(self, config: BartConfig)
hanlp/components/amr/amrbart/model_interface/modeling_bart.py:1147
↓ 12 callersMethodcopy
(self)
hanlp/components/pipeline.py:149
↓ 12 callersMethodtransform
(word: str)
hanlp/common/transform.py:434
↓ 11 callersMethod__init__
(self, src, dst='char', max_word_length=None, min_word_length=None, pad=PAD)
hanlp/common/transform.py:374
↓ 11 callersMethod_send_post_json
(self, url, form: Dict[str, Any])
plugins/hanlp_restful/hanlp_restful/__init__.py:152
↓ 11 callersMethodencoder
(self)
hanlp/components/amr/seq2seq/dataset/tokenization_t5.py:672
↓ 11 callersMethoderase
(self)
hanlp/utils/log_util.py:73
↓ 11 callersMethodto_dict
Convert this vocab to a dict so that it can be json serialized. Returns: A dict.
hanlp/common/vocab.py:260
↓ 10 callersMethodget_idx_without_add
(self, token: str)
hanlp/common/vocab.py:126
↓ 10 callersMethodget_output_dim
(self)
hanlp/components/parsers/biaffine/variationalbilstm.py:230
↓ 9 callersMethodclear
(self)
hanlp/common/vocab.py:374
↓ 9 callersMethodforward
(self, batch: Dict[str, torch.Tensor] )
hanlp/components/srl/span_rank/span_ranking_srl_model.py:485
↓ 9 callersFunctionload_json
(path)
plugins/hanlp_common/hanlp_common/io.py:30
↓ 9 callersMethodmodule
Build a module for this embedding. Args: **kwargs: Containing vocabs, training etc. Not finalized for now. Returns:
hanlp/layers/embeddings/embedding.py:45
↓ 9 callersMethodpad_data
Perform the actual padding for a given data. Args: data: Data to be padded. pad: Padding value. dtype: Da
hanlp/common/dataset.py:468
↓ 9 callersFunctionsave_json
(item: Union[dict, list, str, int, float], path: str, ensure_ascii=False, cls=None, default=lamb
plugins/hanlp_common/hanlp_common/io.py:21
↓ 9 callersMethodshuffle
Shuffle this dataset inplace.
hanlp/common/dataset.py:280
↓ 9 callersFunctiontolist
(t: tf.Tensor)
hanlp/components/parsers/alg_tf.py:27
↓ 9 callersMethodupdate
(self, n=1)
hanlp/utils/time_util.py:74
↓ 8 callersMethoddevice
The first device this component lives on.
hanlp/common/torch_component.py:586
↓ 8 callersMethodfile_to_dataset
Transform file to dataset Parameters ---------- filepath gold : bool Whether it's processing gol
hanlp/common/transform_tf.py:106
↓ 8 callersMethodfrom_config
(meta: dict, **kwargs)
hanlp/components/pipeline.py:72
↓ 8 callersFunctionisdebugging
See Also https://stackoverflow.com/questions/333995/how-to-detect-that-python-code-is-being-executed-through-the-debugger
plugins/hanlp_common/hanlp_common/util.py:25
↓ 8 callersMethodload_json
(self, path)
plugins/hanlp_common/hanlp_common/structure.py:63
↓ 8 callersMethodlog
(self, info=None, ratio_percentage=True, ratio=True, step=0, interval=0.5, erase=True, logger: Uni
hanlp/utils/io_util.py:656
↓ 8 callersMethodnum_training_steps
Caculate number of training steps. Args: num_batches: Size of dataloader. gradient_accumulation: Number of batches p
hanlp/common/structure.py:57
↓ 8 callersFunctionread_tsv_as_sents
(tsv_file_path, ignore_prefix=None, delimiter=None)
hanlp/utils/io_util.py:437
↓ 8 callersMethodset_unk_as_safe_unk
Set ``self.unk_token = self.safe_unk_token``. It's useful when the dev/test set contains OOV labels.
hanlp/common/vocab.py:369
↓ 8 callersFunctionstr_to_type
convert class path in str format to a type Args: classpath: class path Returns: type
plugins/hanlp_common/hanlp_common/reflection.py:33
↓ 8 callersMethodtokenize
(sample: dict, tokenizer, max_src_length=400, max_tgt_length=1024, unified_input=True, amr="src",
hanlp/components/amr/amrbart/data_interface/dataset.py:50
↓ 8 callersMethodvariables
Set of variables in this semantic graph
hanlp/components/amr/seq2seq/dataset/linearization.py:36
↓ 7 callersMethod__init__
(self, in1_features, in2_features, out_features, bias=(True, True))
hanlp/components/srl/span_rank/layer.py:134
↓ 7 callersMethod_shape
(self, tensor: torch.Tensor, seq_len: int, bsz: int)
hanlp/components/amr/amrbart/model_interface/modeling_bart.py:170
↓ 7 callersFunctionbuild_optimizer_scheduler_with_transformer
(model: torch.nn.Module, transformer: torch.nn.Module,
hanlp/layers/transformers/utils.py:296
↓ 7 callersMethodedges
(self)
hanlp/components/parsers/alg_tf.py:158
↓ 7 callersMethodfile_to_samples
Transform file to samples Parameters ---------- filepath gold
hanlp/common/transform_tf.py:94
↓ 7 callersMethodget_idx
(self, token: str)
hanlp/common/vocab_tf.py:84
↓ 7 callersMethodload
(self, filepath)
hanlp/components/pipeline.py:170
↓ 7 callersFunctionpath_join
(path, *paths)
hanlp/utils/io_util.py:73
↓ 7 callersMethodreadline
hanlp/utils/file_read_backwards/file_read_backwards.py:64
↓ 7 callersFunctionremove_file
(filename)
hanlp/utils/io_util.py:135
↓ 7 callersMethodtransit
Transit the state of a Deterministic Finite Automata (DFA) with key. Args: key: A sequence of criterion (tokens or characters) us
plugins/hanlp_trie/hanlp_trie/trie.py:24
↓ 6 callersMethod__init__
(self, data: Union[str, List], transform: Union[Callable, List] = None,
hanlp/common/dataset.py:819
next →1–100 of 2,968, ranked by callers