IlyaGusev/rnnmorph

View on GitHub

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,
Severity: Minor
Found in rnnmorph/char_embeddings_model.py - About 45 mins to fix

    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):
    Severity: Minor
    Found in rnnmorph/data_preparation/word_form.py - About 45 mins to fix

      Function train has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def train(self,
      Severity: Minor
      Found in rnnmorph/char_embeddings_model.py - About 45 mins to fix

        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):
        Severity: Major
        Found in rnnmorph/batch_generator.py - About 45 mins to fix

          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,
          Severity: Minor
          Found in rnnmorph/train.py - About 35 mins to fix

            Function prepare has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def prepare(self, gram_dump_path_input: str, gram_dump_path_output: str,
            Severity: Minor
            Found in rnnmorph/model.py - About 35 mins to fix

              Function build has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def build(self,
              Severity: Minor
              Found in rnnmorph/char_embeddings_model.py - About 35 mins to fix

                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,
                Severity: Minor
                Found in rnnmorph/predictor.py - About 35 mins to fix

                  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: предложения (с разобранными словоформами).
                  Severity: Minor
                  Found in rnnmorph/batch_generator.py - About 35 mins to fix

                  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-тегов по предложению с вероятностями всех вариантов.
                  
                  
                  Severity: Minor
                  Found in rnnmorph/model.py - About 35 mins to fix

                  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:
                  Severity: Minor
                  Found in rnnmorph/tag_genres.py - About 35 mins to fix

                  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
                  Severity: Major
                  Found in rnnmorph/predictor.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                return 'то'
                    Severity: Major
                    Found in rnnmorph/predictor.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                  return 'со'
                      Severity: Major
                      Found in rnnmorph/predictor.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                    return form.inflect({'PRTF', 'sing', 'masc', 'nomn'}).word
                        Severity: Major
                        Found in rnnmorph/predictor.py - About 30 mins to fix

                          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: пути к файлам корпуса.
                          Severity: Minor
                          Found in rnnmorph/data_preparation/loader.py - About 25 mins to fix

                          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:
                                  """
                                  Подготовка векторизатора грамматических значений и словаря слов по корпусу.
                          Severity: Minor
                          Found in rnnmorph/model.py - About 25 mins to fix

                          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: файлы выборки.
                          Severity: Minor
                          Found in rnnmorph/model.py - About 25 mins to fix

                          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):
                          Severity: Minor
                          Found in rnnmorph/model.py - About 25 mins to fix

                          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

                          Severity
                          Category
                          Status
                          Source
                          Language