Showing 39 of 43 total issues
Function build_dense_chars_layer
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def build_dense_chars_layer(max_word_length, char_vocab_size, char_emb_dim,
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, word: str, normal_form: str, pos: str, tag: str, vector: np.array, score: float):
Function train
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def train(self,
Avoid deeply nested control flow statements. Open
if i not in self.indices:
last_sentence = []
i += 1
continue
for index, bucket in enumerate(self.buckets):
Function train
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def train(file_names: List[str], train_config_path: str, build_config_path: str,
Function prepare
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def prepare(self, gram_dump_path_input: str, gram_dump_path_output: str,
Function build
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def build(self,
Function __get_lemma
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __get_lemma(self, word: str, pos_tag: str, gram: str, word_forms=None,
Function __to_tensor
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def __to_tensor(self, sentences: List[List[WordForm]]) -> Tuple[List, List]:
"""
Преобразование предложений в признаки и ответы.
:param sentences: предложения (с разобранными словоформами).
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function predict_probabilities
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def predict_probabilities(self, sentences: List[List[str]], batch_size: int,
build_config: BuildModelConfig) -> List[List[List[float]]]:
"""
Предсказание полных PoS-тегов по предложению с вероятностями всех вариантов.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function tag
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def tag(predictor: RNNMorphPredictor, untagged_filename: str, tagged_filename: str):
sentences = []
with open(untagged_filename, "r", encoding='utf-8') as r:
words = []
for line in r:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this function. Open
return form.normal_form
Avoid too many return
statements within this function. Open
return 'то'
Avoid too many return
statements within this function. Open
return 'со'
Avoid too many return
statements within this function. Open
return form.inflect({'PRTF', 'sing', 'masc', 'nomn'}).word
Function parse_corpora
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def parse_corpora(self, file_names: List[str]):
"""
Построить WordVocabulary, GrammemeVectorizer по корпусу
:param file_names: пути к файлам корпуса.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function prepare
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def prepare(self, gram_dump_path_input: str, gram_dump_path_output: str,
word_vocabulary_dump_path: str, char_set_dump_path: str,
file_names: List[str] = None) -> None:
"""
Подготовка векторизатора грамматических значений и словаря слов по корпусу.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function count_samples
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def count_samples(file_names: List[str]):
"""
Считает количество предложений в выборке.
:param file_names: файлы выборки.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function train
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def train(self, file_names: List[str], train_config: TrainConfig, build_config: BuildModelConfig) -> None:
np.random.seed(train_config.random_seed)
sample_counter = self.count_samples(file_names)
train_idx, val_idx = self.get_split(sample_counter, train_config.val_part)
for big_epoch in range(train_config.epochs_num):
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"