AI Slop Code RIsk Monitor

hankcs/HanLP

Natural Language Processing for the next decade. Tokenization, Part-of-Speech Tagging, Named Entity Recognition, Syntactic & Semantic Dependency Parsing, Document Classification

18.2 Elevated pattern signal View on GitHub

Maintenance and Governance Review

This report summarizes scanner evidence for hankcs/HanLP, a Python project with 36,505 GitHub stars. SynthScan examined 68,636 lines of code across 652 source files, recording 863 pattern matches distributed across 15 syntactic categories. The legacy adjusted pattern signal is 18.2 (Elevated pattern signal); it is not an authorship estimate.

Use the findings to ask whether maintainers can explain intent, verify dependencies, simplify unnecessary scaffolding, and focus review effort. Risk Payload v1 adds ownership, supply-chain, over-engineering, and review-effort vectors when available. These are prompts for human verification, not probabilities, security findings, or measured maintenance costs.

18.2
Adjusted Signal
18.2
Raw Pattern Score
100%
Time Factor
2026-09-15
Last Push
36.5K
Stars
Python
Language
68.6K
Lines of Code
652
Files
863
Pattern Hits
2026-10-12
Scan Date
0.09
HC Hit Rate

Risk Review · v3

Use each vector to guide manual verification of the underlying findings.

Cognitive Ownership Risk 42.8/100 · MEDIUM

Can maintainers explain intent, assumptions, and trade-offs? 627 finding(s).

Hallucinated Dependency & Supply Chain Risk 9.8/100 · LOW

Are imports declared and package/API names verified? 127 finding(s).

Agent Over-Engineering Ratio 35.0/100 · MEDIUM

Are wrappers, guards, and repeated structures necessary? 353 finding(s).

PR Review Velocity Impact 61.4/100 · HIGH

Which changes need focused human review? 863 finding(s).

What These Metrics Mean

Adjusted Signal
Legacy pattern score normalized per 1,000 scanned lines and multiplied by the repository-level time factor. It is not an estimate of AI authorship.
Raw Pattern Score
Sum of severity- and context-weighted pattern findings before applying the time factor.
Time Factor
A coarse multiplier based on repository last-push metadata. It does not identify when individual code was written.
Pattern Hits
Count of configured pattern findings. Review each location and surrounding code before acting.
HC Hit Rate
High- and critical-severity findings per scanned file. Severity is a configured detector weight, not proof of a vulnerability or authorship.
Lines / Files
Scan coverage denominators used by the legacy normalized score.

Pattern-Signal History

Run additional scans to build a history of the legacy pattern signal. Score changes are not a measure of AI adoption or code quality.

No multi-scan history yet — run the scanner again to build trend data.

Severity Breakdown

Groups findings by configured severity weight. Severity is not a confidence estimate, security rating, or proof that a package is missing. Verify imports against the project's manifests and inspect each finding in its local design context.

CRITICAL 1HIGH 60MEDIUM 67LOW 735

Directory Score Breakdown

This horizontal bar chart shows where configured pattern scores accumulate across directories. Treat the bars as locations to inspect, not as evidence of authorship or code quality. Use the file-level findings to decide whether a directory needs a focused ownership, dependency, complexity, or review check.

Pattern Findings

The scanner identified 863 distinct pattern matches across 15 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a detector match to inspect in context. Expand any category row to inspect the individual file paths, line numbers, code snippets, and the lexical context (CODE, COMMENT, or STRING) in which each match was detected.

Reading the findings table: The Severity column indicates the configured finding weight (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — legacy comment-context matches receive a ×1.5 score weight. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier under the legacy scoring model.

Deep Nesting179 hits · 176 pts
SeverityFileLineSnippetContext
LOWplugins/hanlp_common/hanlp_common/util.py82CODE
LOWplugins/hanlp_common/hanlp_common/util.py110CODE
LOWplugins/hanlp_common/hanlp_common/visualization.py26CODE
LOWplugins/hanlp_common/hanlp_common/visualization.py145CODE
LOWplugins/hanlp_common/hanlp_common/document.py18CODE
LOWplugins/hanlp_common/hanlp_common/document.py104CODE
LOWplugins/hanlp_common/hanlp_common/document.py188CODE
LOWplugins/hanlp_common/hanlp_common/document.py436CODE
LOWplugins/hanlp_common/hanlp_common/amr.py144CODE
LOWplugins/hanlp_common/hanlp_common/amr.py359CODE
LOWplugins/hanlp_common/hanlp_common/amr.py529CODE
LOWplugins/hanlp_common/hanlp_common/amr.py549CODE
LOWplugins/hanlp_common/hanlp_common/amr.py724CODE
LOWplugins/hanlp_common/hanlp_common/amr.py890CODE
LOWplugins/hanlp_common/hanlp_common/amr.py904CODE
LOWplugins/hanlp_trie/hanlp_trie/dictionary.py68CODE
LOWplugins/hanlp_trie/hanlp_trie/dictionary.py106CODE
LOWplugins/hanlp_trie/hanlp_trie/dictionary.py184CODE
LOWplugins/hanlp_trie/hanlp_trie/trie.py99CODE
LOWplugins/hanlp_trie/hanlp_trie/trie.py123CODE
LOWhanlp/metrics/chunking/conlleval.py151CODE
LOWhanlp/metrics/parsing/conllx_eval.py40CODE
LOWhanlp/metrics/parsing/semdep_eval.py28CODE
LOWhanlp/layers/embeddings/word2vec_tf.py95CODE
LOWhanlp/layers/embeddings/util_tf.py23CODE
LOWhanlp/layers/transformers/encoder.py19CODE
LOWhanlp/layers/transformers/utils.py101CODE
LOWhanlp/datasets/ner/loaders/json_ner.py141CODE
LOWhanlp/datasets/ner/loaders/json_ner.py34CODE
LOWhanlp/datasets/lm/loaders/lm_dataset.py66CODE
LOWhanlp/datasets/qa/hotpotqa.py147CODE
LOWhanlp/datasets/tokenization/loaders/chunking_dataset.py32CODE
LOWhanlp/datasets/parsing/semeval15.py16CODE
LOWhanlp/datasets/parsing/semeval15.py48CODE
LOWhanlp/datasets/parsing/pmt1.py20CODE
LOWhanlp/datasets/parsing/amr.py83CODE
LOWhanlp/datasets/parsing/amr.py160CODE
LOWhanlp/datasets/parsing/amr.py210CODE
LOWhanlp/datasets/parsing/amr.py259CODE
LOWhanlp/datasets/parsing/amr.py362CODE
LOWhanlp/datasets/parsing/amr.py370CODE
LOWhanlp/datasets/parsing/semeval16.py33CODE
LOWhanlp/datasets/parsing/ud/ud210.py19CODE
LOWhanlp/datasets/parsing/ud/__init__.py12CODE
LOWhanlp/datasets/parsing/ud/ud23.py9CODE
LOWhanlp/datasets/parsing/ud/ud27.py19CODE
LOWhanlp/datasets/parsing/loaders/constituency_dataset.py52CODE
LOWhanlp/datasets/parsing/loaders/_ctb_utils.py107CODE
LOWhanlp/datasets/parsing/loaders/_ctb_utils.py160CODE
LOWhanlp/datasets/parsing/loaders/_ctb_utils.py218CODE
LOWhanlp/datasets/parsing/loaders/conll_dataset.py90CODE
LOWhanlp/datasets/srl/ontonotes5/_utils.py147CODE
LOWhanlp/datasets/srl/ontonotes5/_utils.py269CODE
LOWhanlp/datasets/srl/ontonotes5/_utils.py432CODE
LOWhanlp/datasets/srl/ontonotes5/_utils.py484CODE
LOWhanlp/datasets/srl/ontonotes5/_utils.py499CODE
LOWhanlp/datasets/srl/ontonotes5/_utils.py608CODE
LOWhanlp/datasets/srl/ontonotes5/_utils.py112CODE
LOWhanlp/datasets/srl/loaders/ontonotes_loader.py463CODE
LOWhanlp/datasets/srl/loaders/ontonotes_loader.py586CODE
119 more matches not shown…
Over-Commented Block151 hits · 151 pts
SeverityFileLineSnippetContext
LOWplugins/hanlp_common/__init__.py1# -*- coding:utf-8 -*-COMMENT
LOWplugins/hanlp_common/hanlp_common/__init__.py1# -*- coding:utf-8 -*-COMMENT
LOWplugins/hanlp_common/hanlp_common/visualization.py181 spans.extend([''] * (b - offset))COMMENT
LOWplugins/hanlp_common/hanlp_common/amr.py1# MIT LicenseCOMMENT
LOWplugins/hanlp_common/hanlp_common/amr.py61COMMENT
LOWplugins/hanlp_trie/tests/__init__.py1# -*- coding:utf-8 -*-COMMENT
LOWplugins/hanlp_restful/tests/__init__.py1# -*- coding:utf-8 -*-COMMENT
LOWplugins/hanlp_demo/hanlp_demo/__init__.py1# -*- coding:utf-8 -*-COMMENT
LOWplugins/hanlp_demo/hanlp_demo/mul/__init__.py1# -*- coding:utf-8 -*-COMMENT
LOWplugins/hanlp_demo/hanlp_demo/mul/train/__init__.py1# -*- coding:utf-8 -*-COMMENT
LOWplugins/hanlp_demo/hanlp_demo/ja/__init__.py1# -*- coding:utf-8 -*-COMMENT
LOWplugins/hanlp_demo/hanlp_demo/zh/__init__.py1# -*- coding:utf-8 -*-COMMENT
LOWplugins/hanlp_demo/hanlp_demo/zh/demo_mtl.py1# -*- coding:utf-8 -*-COMMENT
LOWplugins/hanlp_demo/hanlp_demo/zh/train/__init__.py1# -*- coding:utf-8 -*-COMMENT
LOWplugins/hanlp_demo/hanlp_demo/zh/tf/__init__.py1# -*- coding:utf-8 -*-COMMENT
LOWplugins/hanlp_demo/hanlp_demo/zh/tf/train/__init__.py1# -*- coding:utf-8 -*-COMMENT
LOW…demo/hanlp_demo/zh/tf/train/train_ptb_dep_sa_albert.py21# masked_lm_dropout=.33,COMMENT
LOW…/hanlp_demo/zh/tf/train/train_ptb_dep_biaffine_bert.py1# -*- coding:utf-8 -*-COMMENT
LOW…/hanlp_demo/zh/tf/train/train_ptb_dep_biaffine_bert.py21# # early_stopping_patience=10,COMMENT
LOW…p_demo/hanlp_demo/zh/tf/train/train_ptb_dep_sa_bert.py21# masked_lm_dropout=.33,COMMENT
LOW…/zh/tf/train/train_ptb_dep_biaffine_bert_positional.py21 d_positional=128,COMMENT
LOW…gins/hanlp_demo/hanlp_demo/zh/tf/train/cws/__init__.py1# -*- coding:utf-8 -*-COMMENT
LOWplugins/hanlp_demo/hanlp_demo/en/__init__.py1# -*- coding:utf-8 -*-COMMENT
LOWdocs/conf.py81html_sourcelink_suffix = ""COMMENT
LOWdocs/annotations/ner/pku.md1<!--COMMENT
LOWdocs/annotations/ner/msra.md1<!--COMMENT
LOWdocs/annotations/ner/ontonotes.md1<!--COMMENT
LOWdocs/annotations/constituency/ctb.md1<!--COMMENT
LOWdocs/annotations/constituency/npcmj.md1<!--COMMENT
LOWdocs/annotations/constituency/ptb.md1<!--COMMENT
LOWdocs/annotations/pos/pku.md1<!--COMMENT
LOWdocs/annotations/pos/ud.md1<!--COMMENT
LOWdocs/annotations/pos/863.md1<!--COMMENT
LOWdocs/annotations/pos/ctb.md1<!--COMMENT
LOWdocs/annotations/pos/npcmj.md1<!--COMMENT
LOWdocs/annotations/dep/sd_zh.md1<!--COMMENT
LOWdocs/annotations/dep/sd_en.md1<!--COMMENT
LOWdocs/annotations/dep/pmt.md1<!--COMMENT
LOWdocs/annotations/dep/ud.md1<!--COMMENT
LOWdocs/annotations/sdp/semeval16.md1<!--COMMENT
LOWdocs/annotations/srl/propbank.md1<!--COMMENT
LOWdocs/annotations/srl/cpb.md1<!--COMMENT
LOWhanlp/metrics/__init__.py1# -*- coding:utf-8 -*-COMMENT
LOWhanlp/metrics/amr/__init__.py1# -*- coding:utf-8 -*-COMMENT
LOWhanlp/metrics/amr/smatch_eval.py61 # Smatch -> P: 0.136, R: 0.107, F: 0.120COMMENT
LOWhanlp/metrics/chunking/__init__.py1# -*- coding:utf-8 -*-COMMENT
LOWhanlp/metrics/chunking/sequence_labeling.py1# MIT LicenseCOMMENT
LOWhanlp/metrics/parsing/__init__.py1# -*- coding:utf-8 -*-COMMENT
LOWhanlp/metrics/parsing/semdep_eval.py1#!/usr/bin/env pythonCOMMENT
LOWhanlp/metrics/parsing/span.py1# MIT LicenseCOMMENT
LOWhanlp/metrics/parsing/attachmentscore.py1# MIT LicenseCOMMENT
LOWhanlp/metrics/srl/__init__.py1# -*- coding:utf-8 -*-COMMENT
LOWhanlp/losses/__init__.py1# -*- coding:utf-8 -*-COMMENT
LOWhanlp/layers/scalar_mix.py1# This file is modified from udify, which is licensed under the MIT license:COMMENT
LOWhanlp/layers/weight_normalization.py1# Copyright 2019 The TensorFlow Authors. All Rights Reserved.COMMENT
LOWhanlp/layers/__init__.py1# -*- coding:utf-8 -*-COMMENT
LOWhanlp/layers/embeddings/__init__.py1# -*- coding:utf-8 -*-COMMENT
LOWhanlp/layers/transformers/utils.py221 split_input_ids[-1] = F.pad(split_input_ids[-1], pad=[0, padding_amount], value=0)COMMENT
LOWhanlp/layers/transformers/utils_tf.py81 logger.warning(COMMENT
LOWhanlp/layers/crf/crf_tf.py1# Copyright 2019 The TensorFlow Authors. All Rights Reserved.COMMENT
91 more matches not shown…
Decorative Section Separators47 hits · 141 pts
SeverityFileLineSnippetContext
MEDIUMdocs/annotations/ner/pku.md2# ========================================================================COMMENT
MEDIUMdocs/annotations/ner/pku.md19# ========================================================================COMMENT
MEDIUMdocs/annotations/ner/msra.md2# ========================================================================COMMENT
MEDIUMdocs/annotations/ner/msra.md19# ========================================================================COMMENT
MEDIUMdocs/annotations/ner/ontonotes.md2# ========================================================================COMMENT
MEDIUMdocs/annotations/ner/ontonotes.md19# ========================================================================COMMENT
MEDIUMdocs/annotations/constituency/ctb.md2# ========================================================================COMMENT
MEDIUMdocs/annotations/constituency/ctb.md19# ========================================================================COMMENT
MEDIUMdocs/annotations/constituency/npcmj.md2# ========================================================================COMMENT
MEDIUMdocs/annotations/constituency/npcmj.md19# ========================================================================COMMENT
MEDIUMdocs/annotations/constituency/ptb.md2# ========================================================================COMMENT
MEDIUMdocs/annotations/constituency/ptb.md19# ========================================================================COMMENT
MEDIUMdocs/annotations/pos/pku.md2# ========================================================================COMMENT
MEDIUMdocs/annotations/pos/pku.md19# ========================================================================COMMENT
MEDIUMdocs/annotations/pos/ud.md2# ========================================================================COMMENT
MEDIUMdocs/annotations/pos/ud.md19# ========================================================================COMMENT
MEDIUMdocs/annotations/pos/863.md2# ========================================================================COMMENT
MEDIUMdocs/annotations/pos/863.md19# ========================================================================COMMENT
MEDIUMdocs/annotations/pos/ctb.md2# ========================================================================COMMENT
MEDIUMdocs/annotations/pos/ctb.md19# ========================================================================COMMENT
MEDIUMdocs/annotations/pos/npcmj.md2# ========================================================================COMMENT
MEDIUMdocs/annotations/pos/npcmj.md19# ========================================================================COMMENT
MEDIUMdocs/annotations/dep/sd_zh.md2# ========================================================================COMMENT
MEDIUMdocs/annotations/dep/sd_zh.md19# ========================================================================COMMENT
MEDIUMdocs/annotations/dep/sd_en.md2# ========================================================================COMMENT
MEDIUMdocs/annotations/dep/sd_en.md19# ========================================================================COMMENT
MEDIUMdocs/annotations/dep/pmt.md2# ========================================================================COMMENT
MEDIUMdocs/annotations/dep/pmt.md19# ========================================================================COMMENT
MEDIUMdocs/annotations/dep/ud.md2# ========================================================================COMMENT
MEDIUMdocs/annotations/dep/ud.md19# ========================================================================COMMENT
MEDIUMdocs/annotations/sdp/semeval16.md2# ========================================================================COMMENT
MEDIUMdocs/annotations/sdp/semeval16.md19# ========================================================================COMMENT
MEDIUMdocs/annotations/srl/propbank.md2# ========================================================================COMMENT
MEDIUMdocs/annotations/srl/propbank.md19# ========================================================================COMMENT
MEDIUMdocs/annotations/srl/cpb.md2# ========================================================================COMMENT
MEDIUMdocs/annotations/srl/cpb.md19# ========================================================================COMMENT
MEDIUMhanlp/metrics/parsing/semdep_eval.py27# ===============================================================COMMENT
MEDIUMhanlp/metrics/parsing/semdep_eval.py121# ===============================================================COMMENT
MEDIUMhanlp/layers/weight_normalization.py14# =============================================================================COMMENT
MEDIUMhanlp/layers/crf/crf_tf.py14# ==============================================================================COMMENT
MEDIUMhanlp/optimizers/adamw/optimization.py14# ==============================================================================COMMENT
MEDIUMhanlp/components/parsers/parse_alg.py40 # =============================================================COMMENT
MEDIUMhanlp/components/parsers/parse_alg.py76 # ======================COMMENT
MEDIUMhanlp/components/parsers/alg_tf.py120 # =============================================================COMMENT
MEDIUMhanlp/components/parsers/alg_tf.py156 # ======================COMMENT
MEDIUMhanlp/components/parsers/biaffine_tf/alg.py120 # =============================================================COMMENT
MEDIUMhanlp/components/parsers/biaffine_tf/alg.py156 # ======================COMMENT
Hyper-Verbose Identifiers131 hits · 138 pts
SeverityFileLineSnippetContext
LOWplugins/hanlp_common/hanlp_common/amr.py581 def trim_very_long_tgt_tokens(tgt_tokens, head_tags, head_indices, node_to_idx):CODE
LOWplugins/hanlp_common/hanlp_common/amr.py626 def add_source_side_tags_to_target_side(_src_tokens, _src_tags):CODE
LOW⚡plugins/hanlp_restful/tests/test_client.py44 def test_coreference_resolution(self):CODE
LOW⚡plugins/hanlp_restful/tests/test_client.py52 def test_abstract_meaning_representation(self):CODE
LOW⚡plugins/hanlp_restful/tests/test_client.py59 def test_keyphrase_extraction(self):CODE
LOW⚡plugins/hanlp_restful/tests/test_client.py64 def test_extractive_summarization(self):CODE
LOWplugins/hanlp_restful/hanlp_restful/__init__.py203 def semantic_textual_similarity(self, text: Union[Tuple[str, str], List[Tuple[str, str]]], language: str = None) \CODE
LOWplugins/hanlp_restful/hanlp_restful/__init__.py330 def abstract_meaning_representation(self,STRING
LOWplugins/hanlp_restful/hanlp_restful/__init__.py443 def abstractive_summarization(STRING
LOWplugins/hanlp_restful/hanlp_restful/__init__.py475 def grammatical_error_correction(self, text: Union[str, List[str]], language: str = None) \STRING
LOWtests/test_string_util.py10 def test_enumerate_tokenization(self):CODE
LOWtests/test_mtl.py42 def test_sdp_as_the_first_task(self):CODE
LOWtests/test_mtl.py73 def test_unicode_removed_by_hf(self):CODE
LOWhanlp/layers/embeddings/util_tf.py78def embeddings_require_string_input(embeddings):CODE
LOWhanlp/layers/embeddings/util_tf.py85def embeddings_require_char_input(embeddings):CODE
LOWhanlp/layers/transformers/encoder.py128 def build_transformer_tokenizer(config_or_str, use_fast=True, do_basic_tokenize=True) -> PreTrainedTokenizer:CODE
LOWhanlp/layers/transformers/utils.py81def pick_tensor_for_each_token(h, token_span, average_subwords):CODE
LOWhanlp/layers/transformers/utils.py101def transformer_sliding_window(transformer: PreTrainedModel,CODE
LOWhanlp/layers/transformers/utils.py227def restore_from_sliding_window(all_encoder_layers, batch_size, max_pieces, full_seq_len, start_tokens, end_tokens):CODE
LOWhanlp/layers/transformers/utils.py253def build_optimizer_for_pretrained(model: torch.nn.Module,CODE
LOWhanlp/layers/transformers/utils.py296def build_optimizer_scheduler_with_transformer(model: torch.nn.Module,CODE
LOWhanlp/layers/transformers/utils_tf.py13def convert_examples_to_features(CODE
LOWhanlp/layers/transformers/utils_tf.py173def adjust_tokens_for_transformers(sentence):CODE
LOWhanlp/layers/crf/crf_tf.py75def crf_multitag_sequence_score(inputs, tag_bitmap, sequence_lengths,CODE
LOWhanlp/datasets/tokenization/loaders/txt.py85def generate_tags_for_subtokens(sample: dict, tagging_scheme='BMES'):CODE
LOWhanlp/datasets/tokenization/loaders/txt.py117def subtoken_offsets_to_subtokens(text, token_subtoken_offsets):CODE
LOWhanlp/datasets/tokenization/loaders/txt.py124def subtokens_group_to_subtokens(tokens, subtoken_offsets_group):CODE
LOWhanlp/datasets/parsing/semeval15.py16def unpack_deps_to_head_deprel(sample: dict, pad_rel=None, arc_key='arc', rel_key='rel'):CODE
LOWhanlp/datasets/parsing/amr.py316def remove_unconnected_components(concept: List, edge: List):CODE
LOWhanlp/datasets/parsing/amr.py342def largest_connected_component(triples: List):CODE
LOWhanlp/datasets/parsing/amr.py362def reverse_edge_for_levi_bfs(concept, edge):CODE
LOW⚡hanlp/datasets/srl/ontonotes5/_utils.py463def make_ner_tsv_if_necessary(json_file):CODE
LOW⚡hanlp/datasets/srl/ontonotes5/_utils.py471def batch_make_ner_tsv_if_necessary(json_files):CODE
LOW⚡hanlp/datasets/srl/ontonotes5/_utils.py476def make_pos_tsv_if_necessary(json_file):CODE
LOW⚡hanlp/datasets/srl/ontonotes5/_utils.py518def make_con_txt_if_necessary(json_file):CODE
LOW⚡hanlp/datasets/srl/ontonotes5/_utils.py526def batch_make_con_txt_if_necessary(json_files):CODE
LOW⚡hanlp/datasets/srl/ontonotes5/_utils.py531def batch_remove_empty_category_if_necessary(json_files):CODE
LOW⚡hanlp/datasets/srl/ontonotes5/_utils.py544def make_dep_conllx_if_necessary(con_txt_file: str, language='en'):CODE
LOW⚡hanlp/datasets/srl/ontonotes5/_utils.py552def batch_make_dep_conllx_if_necessary(con_txt_files, language='en'):CODE
LOW⚡hanlp/datasets/srl/ontonotes5/_utils.py557def make_ner_json_if_necessary(json_file):CODE
LOW⚡hanlp/datasets/srl/ontonotes5/_utils.py565def batch_make_ner_json_if_necessary(json_files):CODE
LOW⚡hanlp/datasets/srl/ontonotes5/_utils.py574def make_srl_json_if_necessary(json_file):CODE
LOW⚡hanlp/datasets/srl/ontonotes5/_utils.py582def make_coref_json_if_necessary(json_file):CODE
LOW⚡hanlp/datasets/srl/ontonotes5/_utils.py590def batch_make_srl_json_if_necessary(json_files):CODE
LOW⚡hanlp/datasets/srl/ontonotes5/_utils.py599def batch_make_coref_json_if_necessary(json_files):CODE
LOWhanlp/datasets/srl/ontonotes5/_utils.py339def ontonotes_document_generator(input_path, language, labels, stats):CODE
LOWhanlp/datasets/srl/ontonotes5/_utils.py371def make_ontonotes_language_jsonlines(conll12_ontonotes_path, output_path=None, language='english'):CODE
LOWhanlp/datasets/srl/ontonotes5/_utils.py494def batch_make_pos_tsv_if_necessary(json_files):CODE
LOWhanlp/datasets/srl/ontonotes5/_utils.py642def make_raw_text_if_necessary(home: str):CODE
LOWhanlp/datasets/srl/loaders/ontonotes_loader.py205 def dataset_document_iterator(self, file_path: str) -> Iterator[List[OntonotesSentence]]:CODE
LOWhanlp/datasets/srl/loaders/ontonotes_loader.py369 def _process_coref_span_annotations_for_word(CODE
LOWhanlp/datasets/srl/loaders/ontonotes_loader.py420 def _process_span_annotations_for_word(CODE
LOWhanlp/datasets/coref/loaders/conll12coref.py16 def dataset_document_iterator(self, file_path: str) -> Iterator[List[OntonotesSentence]]:CODE
LOWhanlp/utils/io_util.py455def generate_words_tags_from_tsv(tsv_file_path, lower=False, gold=True, max_seq_length=None, sent_delimiter=None,CODE
LOWhanlp/utils/io_util.py588def get_exitcode_stdout_stderr(cmd):CODE
LOWhanlp/utils/io_util.py700def get_latest_info_from_pypi(package='hanlp', repository_url='https://pypi.python.org/pypi/%s/json'):CODE
LOWhanlp/utils/file_read_backwards/buffer_work_space.py156def _remove_trailing_new_line(l):CODE
LOWhanlp/utils/file_read_backwards/buffer_work_space.py189def _is_partially_read_new_line(b):CODE
LOWhanlp/components/lemmatizer.py13def add_lemma_rules_to_sample(sample: dict):CODE
LOW…omponents/amr/amrbart/model_interface/modeling_bart.py513 def _set_gradient_checkpointing(self, module, value=False):CODE
71 more matches not shown…
Docstring Block Structure27 hits · 135 pts
SeverityFileLineSnippetContext
HIGHplugins/hanlp_common/hanlp_common/conll.py360 Checks if a dependency tree is projective. This also works for partial annotation. Besides the obvious croSTRING
HIGHplugins/hanlp_restful/hanlp_restful/__init__.py70 Parse a piece of text. Args: text: A document (str), or a list of sentences (List[str]). STRING
HIGHplugins/hanlp_restful/hanlp_restful/__init__.py172 Text style transfer aims to change the style of the input text to the target style while preserving its contentSTRING
HIGHplugins/hanlp_restful/hanlp_restful/__init__.py205 Semantic textual similarity deals with determining how similar two pieces of texts are. Args: textSTRING
HIGHplugins/hanlp_restful/hanlp_restful/__init__.py235 Coreference resolution is the task of clustering mentions in text that refer to the same underlying real world STRING
HIGHplugins/hanlp_restful/hanlp_restful/__init__.py276 Split a document into sentences and tokenize them. Note that it is always faster to tokenize a whole document tSTRING
HIGHplugins/hanlp_restful/hanlp_restful/__init__.py336Abstract Meaning Representation (AMR) captures “who is doing what to whom” in a sentence. Each sentence is repreSTRING
HIGHplugins/hanlp_restful/hanlp_restful/__init__.py375 Keyphrase extraction aims to identify keywords or phrases reflecting the main topics of a document. Args: STRING
HIGHplugins/hanlp_restful/hanlp_restful/__init__.py408 Single document summarization is the task of selecting a subset of the sentences which best represents a summarSTRING
HIGHplugins/hanlp_restful/hanlp_restful/__init__.py448 Abstractive Summarization is the task of generating a short and concise summary that captures the salient ideasSTRING
HIGHplugins/hanlp_restful/hanlp_restful/__init__.py477 Grammatical Error Correction (GEC) is the task of correcting different kinds of errors in text such as spellingSTRING
HIGHplugins/hanlp_restful/hanlp_restful/__init__.py525 Sentiment analysis is the task of classifying the polarity of a given text. For instance, a text-based STRING
HIGHplugins/hanlp_restful/hanlp_restful/__init__.py555 Identify the language of a given text. Args: text: A document or a list of documents. STRING
HIGHhanlp/__init__.py19Load a pretrained component from an identifier. Args: save_dir (str): The identifier to the saved component. STRING
HIGHhanlp/metrics/chunking/sequence_labeling.py323Build a text report showing the main classification metrics. Args: y_true: 2d array. Ground truth (correct) tSTRING
HIGHhanlp/layers/weight_normalization.py26This wrapper reparameterizes a layer by decoupling the weight's magnitude and direction. This speeds up conSTRING
HIGHhanlp/datasets/parsing/loaders/constituency_dataset.py53 Conducts binarization over the tree. First, the tree is transformed to satisfy `Chomsky Normal Form (CNF)`_. STRING
HIGHhanlp/datasets/parsing/loaders/constituency_dataset.py106 Factorizes the tree into a sequence. The tree is traversed in pre-order. Args: tree (tree.Tree): STRING
HIGHhanlp/datasets/parsing/loaders/constituency_dataset.py165 Builds a constituency tree from the sequence. The sequence is generated in pre-order. During building the tree,STRING
HIGHhanlp/components/parsers/alg.py30 KMeans algorithm for clustering the sentences by length. Args: x (list[int]): The list of STRING
HIGHhanlp/components/parsers/alg.py103 First-order Eisner algorithm for projective decoding. References: - Ryan McDonald, Koby Crammer and FeSTRING
HIGHhanlp/components/parsers/alg.py247 The implementation of `Cocke-Kasami-Younger`_ (CKY) algorithm to parse constituency trees. References: STRING
HIGHhanlp/components/parsers/alg.py319 Checks if the arcs form an valid dependency tree. Args: sequence (list[int]): A list of heSTRING
HIGHhanlp/components/parsers/alg.py353 Tarjan algorithm for finding Strongly Connected Components (SCCs) of a graph. Args: sequence (list): STRING
HIGHhanlp/components/parsers/alg.py409 ChuLiu/Edmonds algorithm for non-projective decoding. Some code is borrowed from `tdozat's implementation`_. STRING
HIGHhanlp/components/parsers/alg.py508 MST algorithm for decoding non-pojective trees. This is a wrapper for ChuLiu/Edmonds algorithm. The algoriSTRING
HIGHhanlp/components/parsers/alg.py567 Second-order Eisner algorithm for projective decoding. This is an extension of the first-order one that furtherSTRING
Unused Imports126 hits · 126 pts
SeverityFileLineSnippetContext
LOWplugins/hanlp_common/hanlp_common/document.py6CODE
LOWplugins/hanlp_trie/hanlp_trie/__init__.py4CODE
LOWplugins/hanlp_trie/hanlp_trie/__init__.py5CODE
LOWplugins/hanlp_trie/hanlp_trie/__init__.py5CODE
LOWplugins/hanlp_demo/hanlp_demo/zh/demo_ner_dict.py6CODE
LOWplugins/hanlp_demo/hanlp_demo/zh/demo_pos_dict.py7CODE
LOWplugins/hanlp_demo/hanlp_demo/zh/train/open_small.py4CODE
LOWplugins/hanlp_demo/hanlp_demo/zh/train/open_base.py4CODE
LOW…hanlp_demo/zh/tf/train/train_ptb_dep_sa_albert_topk.py4CODE
LOW…hanlp_demo/zh/tf/train/train_ptb_dep_sa_albert_topk.py7CODE
LOW…hanlp_demo/zh/tf/train/train_ptb_dep_sa_albert_topk.py9CODE
LOW…demo/hanlp_demo/zh/tf/train/train_ptb_dep_sa_albert.py4CODE
LOW…demo/hanlp_demo/zh/tf/train/train_ptb_dep_sa_albert.py6CODE
LOW…demo/hanlp_demo/zh/tf/train/train_ptb_dep_sa_albert.py6CODE
LOW…demo/hanlp_demo/zh/tf/train/train_ptb_dep_sa_albert.py6CODE
LOW…demo/hanlp_demo/zh/tf/train/train_ptb_dep_sa_albert.py7CODE
LOW…demo/hanlp_demo/zh/tf/train/train_ptb_dep_sa_albert.py9CODE
LOW…/hanlp_demo/zh/tf/train/train_ptb_dep_biaffine_bert.py4CODE
LOW…/hanlp_demo/zh/tf/train/train_ptb_dep_biaffine_bert.py6CODE
LOW…/hanlp_demo/zh/tf/train/train_ptb_dep_biaffine_bert.py6CODE
LOW…/hanlp_demo/zh/tf/train/train_ptb_dep_biaffine_bert.py6CODE
LOW…p_demo/zh/tf/train/train_ptb_dep_biaffine_bert_96.6.py5CODE
LOW…p_demo/zh/tf/train/train_ptb_dep_biaffine_bert_96.6.py5CODE
LOW…p_demo/zh/tf/train/train_ptb_dep_biaffine_bert_96.6.py5CODE
LOW…anlp_demo/zh/tf/train/train_ptb_dep_biaffine_albert.py4CODE
LOW…p_demo/hanlp_demo/zh/tf/train/train_ptb_dep_sa_bert.py4CODE
LOW…p_demo/hanlp_demo/zh/tf/train/train_ptb_dep_sa_bert.py6CODE
LOW…p_demo/hanlp_demo/zh/tf/train/train_ptb_dep_sa_bert.py6CODE
LOW…p_demo/hanlp_demo/zh/tf/train/train_ptb_dep_sa_bert.py6CODE
LOW…p_demo/hanlp_demo/zh/tf/train/train_ptb_dep_sa_bert.py7CODE
LOW…p_demo/hanlp_demo/zh/tf/train/train_ptb_dep_sa_bert.py9CODE
LOW…mo/hanlp_demo/zh/tf/train/train_ptb_dep_sa_pos_bert.py4CODE
LOW…mo/hanlp_demo/zh/tf/train/train_ptb_dep_sa_pos_bert.py6CODE
LOW…mo/hanlp_demo/zh/tf/train/train_ptb_dep_sa_pos_bert.py6CODE
LOW…mo/hanlp_demo/zh/tf/train/train_ptb_dep_sa_pos_bert.py6CODE
LOW…mo/hanlp_demo/zh/tf/train/train_ptb_dep_sa_pos_bert.py7CODE
LOW…mo/hanlp_demo/zh/tf/train/train_ptb_dep_sa_pos_bert.py9CODE
LOW…/zh/tf/train/train_ptb_dep_biaffine_bert_positional.py4CODE
LOWplugins/hanlp_demo/hanlp_demo/en/demo_sdp.py5CODE
LOWhanlp/__init__.py13CODE
LOWhanlp/metrics/parsing/semdep_eval.py18CODE
LOWhanlp/metrics/parsing/semdep_eval.py19CODE
LOWhanlp/metrics/parsing/semdep_eval.py20CODE
LOWhanlp/layers/scalar_mix.py30CODE
LOWhanlp/layers/weight_normalization.py15CODE
LOWhanlp/layers/weight_normalization.py16CODE
LOWhanlp/layers/weight_normalization.py17CODE
LOWhanlp/layers/embeddings/util.py11CODE
LOWhanlp/layers/embeddings/fast_text.py20CODE
LOWhanlp/layers/transformers/tf_imports.py4CODE
LOWhanlp/layers/transformers/tf_imports.py4CODE
LOWhanlp/layers/transformers/tf_imports.py4CODE
LOWhanlp/layers/transformers/tf_imports.py4CODE
LOWhanlp/layers/transformers/tf_imports.py4CODE
LOWhanlp/layers/transformers/tf_imports.py4CODE
LOWhanlp/layers/transformers/tf_imports.py4CODE
LOWhanlp/layers/transformers/tf_imports.py4CODE
LOWhanlp/layers/transformers/tf_imports.py4CODE
LOWhanlp/layers/transformers/tf_imports.py4CODE
LOWhanlp/layers/transformers/tf_imports.py4CODE
66 more matches not shown…
Cross-File Repetition25 hits · 125 pts
SeverityFileLineSnippetContext
HIGHhanlp/datasets/tokenization/sighan2005/msr.py0training set (first 90% of the full official training set).STRING
HIGHhanlp/datasets/tokenization/sighan2005/cityu.py0training set (first 90% of the full official training set).STRING
HIGHhanlp/datasets/tokenization/sighan2005/as_.py0training set (first 90% of the full official training set).STRING
HIGHhanlp/datasets/tokenization/sighan2005/pku.py0training set (first 90% of the full official training set).STRING
HIGH…nents/amr/amrbart/model_interface/tokenization_bart.py0?<[a-z]+:?\d*>| ?:[^\s]+|'s|'t|'re|'ve|'m|'ll|'d| ?\p{l}+| ?\p{n}+| ?[^\s\p{l}\p{n}]+|\s+(?!\s)|\s+STRING
HIGHhanlp/components/amr/seq2seq/dataset/tokenization_t5.py0?<[a-z]+:?\d*>| ?:[^\s]+|'s|'t|'re|'ve|'m|'ll|'d| ?\p{l}+| ?\p{n}+| ?[^\s\p{l}\p{n}]+|\s+(?!\s)|\s+STRING
HIGH…lp/components/amr/seq2seq/dataset/tokenization_bart.py0?<[a-z]+:?\d*>| ?:[^\s]+|'s|'t|'re|'ve|'m|'ll|'d| ?\p{l}+| ?\p{n}+| ?[^\s\p{l}\p{n}]+|\s+(?!\s)|\s+STRING
HIGH…nents/amr/amrbart/model_interface/tokenization_bart.py0tokenize a string. modified in order to handle sentences with recategorization pointersSTRING
HIGHhanlp/components/amr/seq2seq/dataset/tokenization_t5.py0tokenize a string. modified in order to handle sentences with recategorization pointersSTRING
HIGH…lp/components/amr/seq2seq/dataset/tokenization_bart.py0tokenize a string. modified in order to handle sentences with recategorization pointersSTRING
HIGH…nents/amr/amrbart/model_interface/tokenization_bart.py0line = linearized # make sure parentheses match # copied from https://github.com/rikvn/amr/blob/master/restoreamr/restorSTRING
HIGHhanlp/components/amr/seq2seq/dataset/tokenization_t5.py0line = linearized # make sure parentheses match # copied from https://github.com/rikvn/amr/blob/master/restoreamr/restorSTRING
HIGH…lp/components/amr/seq2seq/dataset/tokenization_bart.py0line = linearized # make sure parentheses match # copied from https://github.com/rikvn/amr/blob/master/restoreamr/restorSTRING
HIGHhanlp/components/parsers/parse_alg.py0computes tarjan's algorithm for finding strongly connected components (cycles) of a graphSTRING
HIGHhanlp/components/parsers/alg_tf.py0computes tarjan's algorithm for finding strongly connected components (cycles) of a graphSTRING
HIGHhanlp/components/parsers/biaffine_tf/alg.py0computes tarjan's algorithm for finding strongly connected components (cycles) of a graphSTRING
HIGHhanlp/components/parsers/parse_alg.py0parameters ---------- prediction : numpy.ndarray a predicted dependency tree where prediction[dep_idx] = head_idx tokensSTRING
HIGHhanlp/components/parsers/alg_tf.py0parameters ---------- prediction : numpy.ndarray a predicted dependency tree where prediction[dep_idx] = head_idx tokensSTRING
HIGHhanlp/components/parsers/biaffine_tf/alg.py0parameters ---------- prediction : numpy.ndarray a predicted dependency tree where prediction[dep_idx] = head_idx tokensSTRING
HIGHhanlp/components/parsers/parse_alg.py0adopted from timothy dozat https://github.com/tdozat/parser/blob/master/lib/models/nn.py args: parse_probs(ndarray): seqSTRING
HIGHhanlp/components/parsers/alg_tf.py0adopted from timothy dozat https://github.com/tdozat/parser/blob/master/lib/models/nn.py args: parse_probs(ndarray): seqSTRING
HIGHhanlp/components/parsers/biaffine_tf/alg.py0adopted from timothy dozat https://github.com/tdozat/parser/blob/master/lib/models/nn.py args: parse_probs(ndarray): seqSTRING
HIGH…lp/components/classifiers/transformer_classifier_hf.py0classify text. args: text: a document or a list of documents. topk: ``true`` or ``int`` to return the top-k labels. probSTRING
HIGH…lp/components/classifiers/transformer_regression_hf.py0classify text. args: text: a document or a list of documents. topk: ``true`` or ``int`` to return the top-k labels. probSTRING
HIGHhanlp/components/classifiers/fasttext_classifier.py0classify text. args: text: a document or a list of documents. topk: ``true`` or ``int`` to return the top-k labels. probSTRING
AI Structural Patterns113 hits · 113 pts
SeverityFileLineSnippetContext
LOWplugins/hanlp_common/hanlp_common/conll.py11CODE
LOWplugins/hanlp_common/hanlp_common/conll.py88CODE
LOWplugins/hanlp_common/hanlp_common/document.py188CODE
LOWplugins/hanlp_common/hanlp_common/document.py408CODE
LOWplugins/hanlp_common/hanlp_common/amr.py85CODE
LOWplugins/hanlp_restful/hanlp_restful/__init__.py201CODE
LOWplugins/hanlp_restful/hanlp_restful/__init__.py230CODE
LOWplugins/hanlp_restful/hanlp_restful/__init__.py273CODE
LOWplugins/hanlp_restful/hanlp_restful/__init__.py502CODE
LOWplugins/hanlp_restful/hanlp_restful/__init__.py522CODE
LOWplugins/hanlp_restful/hanlp_restful/__init__.py551CODE
LOWhanlp/layers/embeddings/contextual_word_embedding.py18CODE
LOWhanlp/layers/embeddings/contextual_word_embedding.py79CODE
LOWhanlp/layers/embeddings/word2vec.py94CODE
LOWhanlp/layers/embeddings/char_cnn_tf.py14CODE
LOWhanlp/layers/embeddings/word2vec_tf.py19CODE
LOWhanlp/layers/embeddings/word2vec_tf.py114CODE
LOWhanlp/layers/embeddings/word2vec_tf.py180CODE
LOWhanlp/layers/transformers/encoder.py19CODE
LOWhanlp/layers/transformers/utils_tf.py13CODE
LOWhanlp/datasets/tokenization/loaders/txt.py13CODE
LOW…okenization/loaders/multi_criteria_cws/mcws_dataset.py12CODE
LOWhanlp/datasets/parsing/amr.py83CODE
LOWhanlp/utils/time_util.py165CODE
LOWhanlp/utils/io_util.py660CODE
LOWhanlp/utils/lang/ja/bert_tok.py17CODE
LOWhanlp/optimizers/adamw/optimization.py121CODE
LOWhanlp/components/rnn_language_model_tf.py20CODE
LOWhanlp/components/amr/amrbart/bart_amr_parser.py170CODE
LOW…omponents/amr/amrbart/model_interface/modeling_bart.py382CODE
LOW…omponents/amr/amrbart/model_interface/modeling_bart.py925CODE
LOW…omponents/amr/amrbart/model_interface/modeling_bart.py1181CODE
LOW…omponents/amr/amrbart/model_interface/modeling_bart.py1315CODE
LOW…omponents/amr/amrbart/model_interface/modeling_bart.py1464CODE
LOW…omponents/amr/amrbart/model_interface/modeling_bart.py1590CODE
LOW…omponents/amr/amrbart/model_interface/modeling_bart.py1731CODE
LOW…nents/amr/amrbart/model_interface/tokenization_bart.py36CODE
LOWhanlp/components/amr/seq2seq/seq2seq_amr_parser.py297CODE
LOWhanlp/components/amr/seq2seq/seq2seq_amr_parser.py399CODE
LOWhanlp/components/tokenizers/tok_tf.py54CODE
LOWhanlp/components/tokenizers/tok_tf.py105CODE
LOW…omponents/tokenizers/multi_criteria_cws_transformer.py80CODE
LOWhanlp/components/tokenizers/tok.py48CODE
LOWhanlp/components/tokenizers/transformer.py240CODE
LOWhanlp/components/parsers/biaffine_parser_tf.py60CODE
LOWhanlp/components/parsers/biaffine_parser_tf.py197CODE
LOWhanlp/components/parsers/biaffine_parser_tf.py359CODE
LOWhanlp/components/parsers/biaffine_parser_tf.py441CODE
LOWhanlp/components/parsers/biaffine_parser_tf.py556CODE
LOW…onents/parsers/constituency/crf_constituency_parser.py265CODE
LOWhanlp/components/parsers/ud/ud_parser.py185CODE
LOWhanlp/components/parsers/biaffine/biaffine_2nd_dep.py103CODE
LOWhanlp/components/parsers/biaffine/biaffine_sdp.py153CODE
LOW…nlp/components/parsers/biaffine/structual_attention.py129CODE
LOWhanlp/components/parsers/biaffine/biaffine_dep.py146CODE
LOWhanlp/components/ner/rnn_ner.py33CODE
LOWhanlp/components/ner/transformer_ner.py123CODE
LOWhanlp/components/ner/ner_tf.py37CODE
LOWhanlp/components/ner/ner_tf.py58CODE
LOWhanlp/components/ner/ner_tf.py80CODE
53 more matches not shown…
Empty Error Handlers8 hits · 40 pts
SeverityFileLineSnippetContext
HIGHhanlp/utils/torch_util.py195except IOError:CODE
HIGHhanlp/utils/torch_util.py234except IOError:CODE
HIGHhanlp/utils/component_util.py186except:CODE
HIGHhanlp/utils/io_util.py583except:CODE
HIGHhanlp/components/amr/amrbart/bart_amr_parser.py198except:CODE
HIGHhanlp/components/amr/amrbart/common/postprocessing.py458except:CODE
HIGHhanlp/components/amr/seq2seq/seq2seq_amr_parser.py250except:CODE
HIGHhanlp/components/amr/seq2seq/dataset/postprocessing.py580except:CODE
Excessive Try-Catch Wrapping28 hits · 34 pts
SeverityFileLineSnippetContext
LOWplugins/hanlp_common/hanlp_common/amr.py816 except Exception as e:CODE
LOWhanlp/datasets/parsing/loaders/_ctb_utils.py268 except Exception as e:CODE
LOWhanlp/utils/torch_util.py48 except Exception as e:CODE
LOW⚡hanlp/utils/component_util.py125 except Exception as e:CODE
LOW⚡hanlp/utils/component_util.py130 except Exception as check_e:CODE
LOWhanlp/utils/component_util.py173 except Exception as tf_e:CODE
LOWhanlp/utils/io_util.py226 except Exception as e:CODE
LOWhanlp/utils/io_util.py260 except Exception as e:CODE
LOW…nents/amr/amrbart/model_interface/tokenization_bart.py144 except Exception as e:CODE
LOW…nents/amr/amrbart/model_interface/tokenization_bart.py152 except Exception as e:CODE
LOW…nents/amr/amrbart/model_interface/tokenization_bart.py166 except Exception as e:CODE
MEDIUM…nents/amr/amrbart/model_interface/tokenization_bart.py141def decode_amr(self, tokens, restore_name_ops=None):CODE
LOWhanlp/components/amr/seq2seq/dataset/tokenization_t5.py216 except Exception as e:CODE
LOWhanlp/components/amr/seq2seq/dataset/tokenization_t5.py224 except Exception as e:CODE
LOWhanlp/components/amr/seq2seq/dataset/tokenization_t5.py239 except Exception as e:CODE
LOWhanlp/components/amr/seq2seq/dataset/tokenization_t5.py639 except Exception as e:CODE
LOWhanlp/components/amr/seq2seq/dataset/tokenization_t5.py647 except Exception as e:CODE
LOWhanlp/components/amr/seq2seq/dataset/tokenization_t5.py662 except Exception as e:CODE
MEDIUMhanlp/components/amr/seq2seq/dataset/tokenization_t5.py213def decode_amr(self, tokens, restore_name_ops=False):CODE
MEDIUMhanlp/components/amr/seq2seq/dataset/tokenization_t5.py630def decode_amr(self, tokens, restore_name_ops=None):CODE
LOW…lp/components/amr/seq2seq/dataset/tokenization_bart.py226 except Exception as e:CODE
LOW…lp/components/amr/seq2seq/dataset/tokenization_bart.py234 except Exception as e:CODE
LOW…lp/components/amr/seq2seq/dataset/tokenization_bart.py248 except Exception as e:CODE
LOW…lp/components/amr/seq2seq/dataset/tokenization_bart.py643 except Exception as e:CODE
LOW…lp/components/amr/seq2seq/dataset/tokenization_bart.py651 except Exception as e:CODE
LOW…lp/components/amr/seq2seq/dataset/tokenization_bart.py665 except Exception as e:CODE
MEDIUM…lp/components/amr/seq2seq/dataset/tokenization_bart.py223def decode_amr(self, tokens, restore_name_ops=False):CODE
MEDIUM…lp/components/amr/seq2seq/dataset/tokenization_bart.py635def decode_amr(self, tokens, restore_name_ops=None):CODE
Self-Referential Comments10 hits · 30 pts
SeverityFileLineSnippetContext
MEDIUMplugins/hanlp_common/hanlp_common/document.py29 # Create a documentCOMMENT
MEDIUMplugins/hanlp_demo/hanlp_demo/zh/demo_document.py6# Create a document or get a document from HanLP.parseCOMMENT
MEDIUMplugins/hanlp_demo/hanlp_demo/zh/demo_document.py34# Create a document from a dictCOMMENT
MEDIUMhanlp/layers/scalar_mix.py1# This file is modified from udify, which is licensed under the MIT license:COMMENT
MEDIUMhanlp/layers/dropout.py50 # Create a uniformly random mask selecting either the original words or OOV tokensCOMMENT
MEDIUMhanlp/components/parsers/ud/tag_decoder.py1# This file is modified from udify, which is licensed under the MIT license:COMMENT
MEDIUMhanlp/components/parsers/ud/udify_util.py1# This file is modified from udify and allennlp, which are licensed under the MIT license:COMMENT
MEDIUM…nlp/components/parsers/biaffine/structual_attention.py108 # Create a uniformly random mask selecting either the original words or OOV tokensCOMMENT
MEDIUMhanlp/components/mtl/multi_task_learning.py128 # This method is only called during training or evaluation but not predictionCOMMENT
MEDIUMhanlp/transform/transformer_tokenizer.py325 # The following block will tokenize each empty string (space) into an unk tokenCOMMENT
AI Slop Vocabulary11 hits · 17 pts
SeverityFileLineSnippetContext
LOW…ns/hanlp_demo/hanlp_demo/zh/demo_parse_constituency.py40# If you need to parse raw text, simply add a tokenizer into this pipeline.COMMENT
LOW…ugins/hanlp_demo/hanlp_demo/zh/tf/demo_multiprocess.py17 # Important! The python multiprocessing package defaults to just call fork when creating a child process.COMMENT
LOWhanlp/layers/cnn_encoder.py99 # pooling is simple, we just use `torch.max`. The resultant tensor of has shapeCOMMENT
LOWhanlp/layers/crf/crf_tf.py481 # If max_seq_len is 1, we skip the algorithm and simply return the argmax tagCOMMENT
LOWhanlp/datasets/srl/loaders/ontonotes_loader.py297 # we just set the parse piece to be None which will resultCOMMENT
MEDIUM…nents/amr/amrbart/model_interface/tokenization_bart.py67 """ Tokenize a string. Modified in order to handle sentences with recategorization pointers"""STRING
MEDIUMhanlp/components/amr/seq2seq/dataset/tokenization_t5.py80 """ Tokenize a string. Modified in order to handle sentences with recategorization pointers"""STRING
MEDIUM…lp/components/amr/seq2seq/dataset/tokenization_bart.py88 """ Tokenize a string. Modified in order to handle sentences with recategorization pointers"""STRING
MEDIUMhanlp/components/taggers/tagger.py209 >>> pos.dict_tags = {'HanLP': 'state-of-the-art-tool'} # Force 'HanLP' to be 'state-of-the-art-tool'CODE
MEDIUMhanlp/components/taggers/tagger.py211 # HanLP/state-of-the-art-tool 为/P 生产/NN 环境/NN 带来/VV 次世代/NN 最/AD 先进/VA 的/DEC 多语种/NN NLP/NR 技术/NN 。/PUCOMMENT
LOWhanlp/transform/transformer_tokenizer.py499 # f'Or simply set truncate_long_sequences = False to enable sliding window.')COMMENT
Hallucination Indicators1 hit · 15 pts
SeverityFileLineSnippetContext
CRITICAL⚡hanlp/utils/component_util.py126 if not e.__traceback__.tb_frame.f_code.co_filename.startswith(os.path.dirname(os.path.dirname(__file__))):CODE
Redundant / Tautological Comments5 hits · 8 pts
SeverityFileLineSnippetContext
LOWhanlp/metrics/accuracy.py115 # Check if it's actually a tensor in case something else was passed.COMMENT
LOWhanlp/metrics/accuracy.py226 # Check if it's actually a tensor in case something else was passed.COMMENT
LOWhanlp/layers/crf/crf.py266 # Set score to the next score if this timestep is valid (mask == 1)COMMENT
LOWhanlp/layers/crf/crf.py321 # Set score to the next score if this timestep is valid (mask == 1)COMMENT
LOWhanlp/components/parsers/chu_liu_edmonds.py168 # Check if this solution has a cycle.COMMENT
Modern Structural Boilerplate1 hit · 1 pts
SeverityFileLineSnippetContext
LOWhanlp/datasets/srl/loaders/ontonotes_loader.py10logger = logging.getLogger(__name__)CODE