Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sourcery refactored master branch #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Aug 21, 2022

Branch master refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

To manually merge these changes, make sure you're on the master branch, then run:

git fetch origin sourcery/master
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from hungpham3112 August 21, 2022 17:03
Copy link
Author

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Due to GitHub API limits, only the first 60 comments can be shown.

data = body["_source"]
return data
return body["_source"]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Dictionary.get_word refactored with the following changes:

Comment on lines -43 to +47
search_text_box = placeholder.text_input('Word', value=st.session_state['current_word'], key='sidebar_text_input')
if search_text_box:
if search_text_box := placeholder.text_input(
'Word',
value=st.session_state['current_word'],
key='sidebar_text_input',
):
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 43-59 refactored with the following changes:

Comment on lines -40 to +49
f = open(DICTIONARY_FILE, "a")
i = 0
for res in query_doc(es, index_name):
docs = res["hits"]["hits"]
print(len(docs))
doc_content = extract_dictionary_from_elasticsearch(docs)
if len(doc_content) > 1:
dict_content = yaml.dump(doc_content, allow_unicode=True, sort_keys=True)
f.write(dict_content)
i += 1
f.close()
with open(DICTIONARY_FILE, "a") as f:
i = 0
for res in query_doc(es, index_name):
docs = res["hits"]["hits"]
print(len(docs))
doc_content = extract_dictionary_from_elasticsearch(docs)
if len(doc_content) > 1:
dict_content = yaml.dump(doc_content, allow_unicode=True, sort_keys=True)
f.write(dict_content)
i += 1
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 40-50 refactored with the following changes:

Comment on lines -33 to +50
dict = joblib.load(dict_file)
return dict
return joblib.load(dict_file)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function load_dictionary refactored with the following changes:

Comment on lines -63 to +101
"ADJ", "ADV", "INTJ", "NOUN", "PROPN", "PRON", "SYM", "X", "N:G", "VERB:G", "NY",
"N", "NB", "NNPy",
"NNP", "NNPy",
"V", "VERB",
"Num", "NUMx", "NUM", "NUMX"
"ADJ",
"ADV",
"INTJ",
"NOUN",
"PROPN",
"PRON",
"SYM",
"X",
"N:G",
"VERB:G",
"NY",
"N",
"NB",
"NNP",
"NNPy",
"V",
"VERB",
"Num",
"NUMx",
"NUM",
"NUMX",
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 63-67 refactored with the following changes:

new_sentence = "\n".join(result)
return new_sentence
return "\n".join(result)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function add_lemma_column refactored with the following changes:

if r is None:
return None
return r.json()
return None if r is None else r.json()
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function ChatUser.send refactored with the following changes:

Comment on lines +29 to -31
max_len = 0
for file in ["train.txt", "test.txt", "dev.txt"]:
print(file)
max_len = 0
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 31-31 refactored with the following changes:

Comment on lines -28 to +34
if label not in self.label2index:
index = self.vocab_size
self.label2index[label] = index
self.index2label[index] = label
self.vocab_size += 1
return index
else:
if label in self.label2index:
return self.label2index[label]
index = self.vocab_size
self.label2index[label] = index
self.index2label[index] = label
self.vocab_size += 1
return index
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function LabelEncoder.encode refactored with the following changes:

Comment on lines -190 to +189
optimizer = AdamW(self.parameters(), lr=2e-5)
return optimizer
return AdamW(self.parameters(), lr=2e-5)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function BertForTokenClassification.configure_optimizers refactored with the following changes:

output_line = line.split()[0] + " " + preds_list[example_id].pop(0) + "\n"
output_line = f"{line.split()[0]} {preds_list[example_id].pop(0)}" + "\n"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function NER.write_predictions_to_file refactored with the following changes:

Comment on lines -60 to +66
if path:
with open(path, "r") as f:
labels = f.read().splitlines()
if "O" not in labels:
labels = ["O"] + labels
return labels
else:
if not path:
return ["O", "B-MISC", "I-MISC", "B-PER", "I-PER", "B-ORG", "I-ORG", "B-LOC", "I-LOC"]
with open(path, "r") as f:
labels = f.read().splitlines()
if "O" not in labels:
labels = ["O"] + labels
return labels
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function NER.get_labels refactored with the following changes:

Comment on lines -76 to +75
if path:
with open(path, "r") as f:
labels = f.read().splitlines()
if "O" not in labels:
labels = ["O"] + labels
return labels
else:
if not path:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Chunk.get_labels refactored with the following changes:

optimizer = AdamW(self.parameters(), lr=2e-5)
return optimizer
return AdamW(self.parameters(), lr=2e-5)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function BertForMultilabelClassification.configure_optimizers refactored with the following changes:

Comment on lines -25 to +30
loss = 0
gpt2_outputs = self.gpt2(input_ids)
hidden_states = gpt2_outputs[0].squeeze()
logits = self.logit(self.linear(hidden_states))
batch_size, sequence_length = input_ids.shape[:2]
logits = logits[range(batch_size), sequence_length]
if labels is not None:
loss = self.criterion(logits, labels)
loss = self.criterion(logits, labels) if labels is not None else 0
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function GPT2TextClassification.forward refactored with the following changes:

Comment on lines -53 to +51
optimizer = SGD(self.parameters(), lr=1e-6)
return optimizer
return SGD(self.parameters(), lr=1e-6)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function GPT2TextClassification.configure_optimizers refactored with the following changes:

Comment on lines -21 to +27
for i, line in enumerate(f):
for line in f:
word, freq = line.split("\t\t")
other_words = Normalizer.normalize(word)
uts_words = text_normalize(word)
if word != "nghiêng" and len(word) > 6:
continue
if other_words != word and other_words != uts_words:
if other_words not in [word, uts_words]:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function compare_two_tools refactored with the following changes:

new_s = "\n".join(result)
return new_s
return "\n".join(result)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function predict_sentence refactored with the following changes:

Comment on lines -81 to +126
for key in syllable_map_r:
items = syllable_map_r[key]
for key, items in syllable_map_r.items():
for item in items:
syllable_map[item] = key
NONE_DIACRITIC_SINGLE_VOWELS = set(["a", "e", "i", "o", "u", "y"])
NONE_DIACRITIC_DOUBLE_VOWELS = set([
"ai", "ao", "au", "ay",
"eo", "eu", "ia", "ie", "iu", "oa", "oe", "oi", "oo",
"ua", "ue", "ui", "uo", "uu", "uy", "ye"
])
NONE_DIACRITIC_TRIPLE_VOWELS = set([
"iai", "ieu", "iua", "oai", "oao", "oay", "oeo",
"uao", "uai", "uay", "uoi", "uou", "uya", "uye", "uyu",
"yeu"
])
NONE_DIACRITIC_SINGLE_VOWELS = {"a", "e", "i", "o", "u", "y"}
NONE_DIACRITIC_DOUBLE_VOWELS = {
"ai",
"ao",
"au",
"ay",
"eo",
"eu",
"ia",
"ie",
"iu",
"oa",
"oe",
"oi",
"oo",
"ua",
"ue",
"ui",
"uo",
"uu",
"uy",
"ye",
}

NONE_DIACRITIC_TRIPLE_VOWELS = {
"iai",
"ieu",
"iua",
"oai",
"oao",
"oay",
"oeo",
"uao",
"uai",
"uay",
"uoi",
"uou",
"uya",
"uye",
"uyu",
"yeu",
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 81-95 refactored with the following changes:

Comment on lines -111 to +142
if group in NONE_DIACRITIC_VOWELS:
miss_spell = False
else:
miss_spell = True
miss_spell = group not in NONE_DIACRITIC_VOWELS
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function AnalysableWord.__init__ refactored with the following changes:

Comment on lines -10 to +14
dic = {}
char1252 = 'à|á|ả|ã|ạ|ầ|ấ|ẩ|ẫ|ậ|ằ|ắ|ẳ|ẵ|ặ|è|é|ẻ|ẽ|ẹ|ề|ế|ể|ễ|ệ|ì|í|ỉ|ĩ|ị|ò|ó|ỏ|õ|ọ|ồ|ố|ổ|ỗ|ộ|ờ|ớ|ở|ỡ|ợ|ù|ú|ủ|ũ|ụ|ừ|ứ|ử|ữ|ự|ỳ|ý|ỷ|ỹ|ỵ|À|Á|Ả|Ã|Ạ|Ầ|Ấ|Ẩ|Ẫ|Ậ|Ằ|Ắ|Ẳ|Ẵ|Ặ|È|É|Ẻ|Ẽ|Ẹ|Ề|Ế|Ể|Ễ|Ệ|Ì|Í|Ỉ|Ĩ|Ị|Ò|Ó|Ỏ|Õ|Ọ|Ồ|Ố|Ổ|Ỗ|Ộ|Ờ|Ớ|Ở|Ỡ|Ợ|Ù|Ú|Ủ|Ũ|Ụ|Ừ|Ứ|Ử|Ữ|Ự|Ỳ|Ý|Ỷ|Ỹ|Ỵ'.split(
'|')
charutf8 = "à|á|ả|ã|ạ|ầ|ấ|ẩ|ẫ|ậ|ằ|ắ|ẳ|ẵ|ặ|è|é|ẻ|ẽ|ẹ|ề|ế|ể|ễ|ệ|ì|í|ỉ|ĩ|ị|ò|ó|ỏ|õ|ọ|ồ|ố|ổ|ỗ|ộ|ờ|ớ|ở|ỡ|ợ|ù|ú|ủ|ũ|ụ|ừ|ứ|ử|ữ|ự|ỳ|ý|ỷ|ỹ|ỵ|À|Á|Ả|Ã|Ạ|Ầ|Ấ|Ẩ|Ẫ|Ậ|Ằ|Ắ|Ẳ|Ẵ|Ặ|È|É|Ẻ|Ẽ|Ẹ|Ề|Ế|Ể|Ễ|Ệ|Ì|Í|Ỉ|Ĩ|Ị|Ò|Ó|Ỏ|Õ|Ọ|Ồ|Ố|Ổ|Ỗ|Ộ|Ờ|Ớ|Ở|Ỡ|Ợ|Ù|Ú|Ủ|Ũ|Ụ|Ừ|Ứ|Ử|Ữ|Ự|Ỳ|Ý|Ỷ|Ỹ|Ỵ".split(
'|')
for i in range(len(char1252)):
dic[char1252[i]] = charutf8[i]
return dic
return {char1252[i]: charutf8[i] for i in range(len(char1252))}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function loaddicchar refactored with the following changes:

Comment on lines -133 to +130
if x == 4 or x == 8: # ê, ơ
if x in [4, 8]: # ê, ơ
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function chuan_hoa_dau_tu_tieng_viet refactored with the following changes:

if nguyen_am_index == -1:
if nguyen_am_index == -1 or index - nguyen_am_index == 1:
nguyen_am_index = index
else:
if index - nguyen_am_index != 1:
return False
nguyen_am_index = index
return False
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function is_valid_vietnam_word refactored with the following changes:

Comment on lines -64 to +67
if response.status_code not in [200, 302]:
if "www.dropbox.com" in url:
# dropbox return code 301, so we ignore this error
pass
else:
raise IOError("HEAD request failed for url {}".format(url))
if response.status_code not in [200, 302] and "www.dropbox.com" not in url:
raise IOError(f"HEAD request failed for url {url}")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function get_from_cache refactored with the following changes:

This removes the following comments ( why? ):

# dropbox return code 301, so we ignore this error

Comment on lines -118 to +116
if use_slower_interval:
Tqdm.default_mininterval = 10.0
else:
Tqdm.default_mininterval = 0.1
Tqdm.default_mininterval = 10.0 if use_slower_interval else 0.1
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Tqdm.set_slower_interval refactored with the following changes:

Comment on lines -159 to +160
if not all:
if license == "Close":
continue
if not all and license == "Close":
continue
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function ModelFetcher.list refactored with the following changes:

if 0.0 <= score <= 1.0:
self._score = score
else:
self._score = 1.0
self._score = score if 0.0 <= score <= 1.0 else 1.0
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Label.score refactored with the following changes:

Comment on lines -29 to +26
return "{} ({})".format(self._value, self._score)
return f"{self._value} ({self._score})"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Label.__str__ refactored with the following changes:

@sourcery-ai
Copy link
Author

sourcery-ai bot commented Aug 21, 2022

Sourcery Code Quality Report

✅  Merging this PR will increase code quality in the affected files by 0.13%.

Quality metrics Before After Change
Complexity 4.96 ⭐ 4.66 ⭐ -0.30 👍
Method Length 52.44 ⭐ 51.92 ⭐ -0.52 👍
Working memory 7.15 🙂 7.21 🙂 0.06 👎
Quality 72.66% 🙂 72.79% 🙂 0.13% 👍
Other metrics Before After Change
Lines 6961 6972 11
Changed files Quality Before Quality After Quality Change
travis_pypi_setup.py 90.30% ⭐ 89.72% ⭐ -0.58% 👎
apps/col_data.py 87.31% ⭐ 87.29% ⭐ -0.02% 👎
apps/col_dictionary.py 71.13% 🙂 70.08% 🙂 -1.05% 👎
apps/col_dictionary_export_from_elasticsearch.py 75.83% ⭐ 76.34% ⭐ 0.51% 👍
apps/col_dictionary_import_to_elasticsearch.py 76.90% ⭐ 76.75% ⭐ -0.15% 👎
apps/col_streamlit.py 76.45% ⭐ 75.48% ⭐ -0.97% 👎
datasets/DI_Vietnamese-UVD/scripts/correct_v1.0.alpha.py 76.93% ⭐ 78.31% ⭐ 1.38% 👍
datasets/DI_Vietnamese-UVD/scripts/data.py 88.72% ⭐ 90.53% ⭐ 1.81% 👍
datasets/DI_Vietnamese-UVD/scripts/underthesea_v170_dictionary.py 46.35% 😞 46.47% 😞 0.12% 👍
datasets/DI_Vietnamese-UVD/scripts/validate.py 83.49% ⭐ 83.38% ⭐ -0.11% 👎
datasets/DI_Vietnamese-UVD/scripts/validate_with_corpus.py 73.48% 🙂 72.77% 🙂 -0.71% 👎
datasets/UD_Vietnamese-COL/scripts/make_corpus.py 75.70% ⭐ 76.28% ⭐ 0.58% 👍
examples/chatbot/baggage_claim/run_tests.py 67.78% 🙂 66.93% 🙂 -0.85% 👎
examples/ner/preprocess_data.py 78.05% ⭐ 78.05% ⭐ 0.00%
examples/ner/run_ner_pl.py 84.80% ⭐ 84.78% ⭐ -0.02% 👎
examples/ner/tasks.py 64.96% 🙂 65.56% 🙂 0.60% 👍
examples/ner/utils_ner.py 39.26% 😞 39.28% 😞 0.02% 👍
examples/sentiment/data.py 81.11% ⭐ 81.99% ⭐ 0.88% 👍
examples/sentiment/train_bert.py 78.89% ⭐ 78.31% ⭐ -0.58% 👎
examples/sentiment/train_gpt2.py 80.38% ⭐ 80.72% ⭐ 0.34% 👍
examples/text_normalize/compare_tool.py 61.47% 🙂 62.66% 🙂 1.19% 👍
examples/text_normalize/evaluation.py 63.10% 🙂 63.44% 🙂 0.34% 👍
examples/text_normalize/normalize.py 73.98% 🙂 74.04% 🙂 0.06% 👍
examples/text_normalize/tools/nvh.py 52.37% 🙂 51.58% 🙂 -0.79% 👎
examples/text_normalize/tools/vtm.py 96.34% ⭐ 99.50% ⭐ 3.16% 👍
examples/text_normalize/tools/vtt.py 96.34% ⭐ 99.50% ⭐ 3.16% 👍
extensions/underthesea_core/lab_underthesea_core.py 83.50% ⭐ 83.80% ⭐ 0.30% 👍
tests/featurizers/benchmark_featurizers.py 49.77% 😞 51.35% 🙂 1.58% 👍
underthesea/init.py 73.88% 🙂 73.71% 🙂 -0.17% 👎
underthesea/data_fetcher.py 70.00% 🙂 70.32% 🙂 0.32% 👍
underthesea/file_utils.py 64.65% 🙂 65.19% 🙂 0.54% 👍
underthesea/model_fetcher.py 51.35% 🙂 51.53% 🙂 0.18% 👍
underthesea/corpus/data.py 93.81% ⭐ 93.68% ⭐ -0.13% 👎
underthesea/corpus/tagged_corpus.py 86.97% ⭐ 87.08% ⭐ 0.11% 👍
underthesea/corpus/util.py 70.59% 🙂 69.83% 🙂 -0.76% 👎
underthesea/corpus/validate_corpus.py 63.49% 🙂 63.51% 🙂 0.02% 👍
underthesea/corpus/word_tokenize_corpus.py 84.56% ⭐ 84.55% ⭐ -0.01% 👎
underthesea/corpus/ws_corpus.py 80.61% ⭐ 80.36% ⭐ -0.25% 👎
underthesea/datasets/uit_absa_hotel/uit_absa_hotel.py 82.75% ⭐ 82.85% ⭐ 0.10% 👍
underthesea/datasets/uit_absa_restaurant/uit_absa_restaurant.py 82.75% ⭐ 82.85% ⭐ 0.10% 👍
underthesea/datasets/vlsp2013_wtk/revise_1.py 65.56% 🙂 68.63% 🙂 3.07% 👍
underthesea/datasets/vlsp2013_wtk/revise_2.py 68.07% 🙂 69.44% 🙂 1.37% 👍
underthesea/datasets/vlsp2013_wtk/revise_corpus.py 92.62% ⭐ 92.66% ⭐ 0.04% 👍
underthesea/dictionary/init.py 93.95% ⭐ 92.15% ⭐ -1.80% 👎
underthesea/feature_engineering/feature.py 71.02% 🙂 74.33% 🙂 3.31% 👍
underthesea/models/crf_sequence_tagger.py 89.58% ⭐ 89.66% ⭐ 0.08% 👍
underthesea/models/text_classifier.py 58.04% 🙂 59.64% 🙂 1.60% 👍
underthesea/modules/base.py 71.24% 🙂 71.26% 🙂 0.02% 👍
underthesea/modules/embeddings.py 96.17% ⭐ 96.63% ⭐ 0.46% 👍
underthesea/pipeline/chunking/init.py 90.86% ⭐ 91.22% ⭐ 0.36% 👍
underthesea/pipeline/chunking/model_crf.py 88.06% ⭐ 89.09% ⭐ 1.03% 👍
underthesea/pipeline/chunking/tagged_feature.py 69.49% 🙂 72.65% 🙂 3.16% 👍
underthesea/pipeline/classification/text_features.py 89.33% ⭐ 90.42% ⭐ 1.09% 👍
underthesea/pipeline/ner/init.py 90.86% ⭐ 91.22% ⭐ 0.36% 👍
underthesea/pipeline/ner/model_crf.py 87.74% ⭐ 88.80% ⭐ 1.06% 👍
underthesea/pipeline/ner/tagged_feature.py 69.49% 🙂 72.65% 🙂 3.16% 👍
underthesea/pipeline/pos_tag/init.py 91.06% ⭐ 91.55% ⭐ 0.49% 👍
underthesea/pipeline/pos_tag/tagged_feature.py 69.49% 🙂 72.65% 🙂 3.16% 👍
underthesea/pipeline/sent_tokenize/init.py 79.91% ⭐ 79.76% ⭐ -0.15% 👎
underthesea/pipeline/sentiment/bank/text_features.py 89.33% ⭐ 90.42% ⭐ 1.09% 👍
underthesea/pipeline/sentiment/general/init.py 73.70% 🙂 74.19% 🙂 0.49% 👍
underthesea/pipeline/sentiment/general/text_features.py 88.77% ⭐ 89.52% ⭐ 0.75% 👍
underthesea/pipeline/text_normalize/init.py 86.94% ⭐ 86.19% ⭐ -0.75% 👎
underthesea/pipeline/text_normalize/token_normalize.py 90.04% ⭐ 90.20% ⭐ 0.16% 👍
underthesea/pipeline/word_tokenize/init.py 62.76% 🙂 62.88% 🙂 0.12% 👍
underthesea/pipeline/word_tokenize/model.py 86.68% ⭐ 86.63% ⭐ -0.05% 👎
underthesea/pipeline/word_tokenize/nightly.py 79.78% ⭐ 79.47% ⭐ -0.31% 👎
underthesea/pipeline/word_tokenize/regex_tokenize.py 50.40% 🙂 49.74% 😞 -0.66% 👎
underthesea/transformer/number.py 87.07% ⭐ 90.55% ⭐ 3.48% 👍
underthesea/transformer/tagged.py 51.12% 🙂 52.42% 🙂 1.30% 👍
underthesea/transformer/tagged_feature.py 91.02% ⭐ 93.21% ⭐ 2.19% 👍
underthesea/transformer/word_vector.py 81.69% ⭐ 81.91% ⭐ 0.22% 👍
underthesea/transforms/conll.py 68.75% 🙂 68.97% 🙂 0.22% 👍
underthesea/util/init.py 73.07% 🙂 70.05% 🙂 -3.02% 👎
underthesea/utils/init.py 51.71% 🙂 56.14% 🙂 4.43% 👍
underthesea/utils/col_analyzer.py 83.73% ⭐ 83.92% ⭐ 0.19% 👍
underthesea/utils/col_dictionary.py 81.89% ⭐ 81.80% ⭐ -0.09% 👎
underthesea/utils/col_external_dictionary.py 79.30% ⭐ 78.89% ⭐ -0.41% 👎
underthesea/utils/col_lyrics.py 66.17% 🙂 65.82% 🙂 -0.35% 👎
underthesea/utils/col_script.py 85.25% ⭐ 85.17% ⭐ -0.08% 👎
underthesea/utils/col_sketchengine.py 75.53% ⭐ 75.47% ⭐ -0.06% 👎
underthesea/utils/col_stopwords.py 82.73% ⭐ 82.78% ⭐ 0.05% 👍
underthesea/utils/col_wiki_clean.py 83.81% ⭐ 82.35% ⭐ -1.46% 👎
underthesea/utils/col_wiki_ud.py 82.60% ⭐ 81.22% ⭐ -1.38% 👎
underthesea/utils/sp_config.py 86.98% ⭐ 86.74% ⭐ -0.24% 👎
underthesea/utils/sp_data.py 75.83% ⭐ 76.08% ⭐ 0.25% 👍
underthesea/utils/sp_embedding.py 88.11% ⭐ 88.95% ⭐ 0.84% 👍
underthesea/utils/sp_field.py 72.77% 🙂 73.23% 🙂 0.46% 👍
underthesea/utils/sp_vocab.py 87.61% ⭐ 87.26% ⭐ -0.35% 👎

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
examples/ner/utils_ner.py TokenClassificationTask.convert_examples_to_features 30 😞 477 ⛔ 24 ⛔ 12.31% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
examples/text_normalize/tools/nvh.py chuan_hoa_dau_tu_tieng_viet 44 ⛔ 339 ⛔ 16 ⛔ 14.24% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
underthesea/corpus/validate_corpus.py validate_token 17 🙂 280 ⛔ 14 😞 31.65% 😞 Try splitting into smaller methods. Extract out complex expressions
underthesea/transformer/tagged.py TaggedTransformer.word2features 24 😞 179 😞 15 😞 31.68% 😞 Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
underthesea/modules/base.py BiLSTM.forward 5 ⭐ 302 ⛔ 17 ⛔ 38.20% 😞 Try splitting into smaller methods. Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant