IlyaGusev/rnnmorph

View on GitHub
rnnmorph/predictor.py

Summary

Maintainability
C
1 day
Test Coverage

Function __get_lemma has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def __get_lemma(self, word: str, pos_tag: str, gram: str, word_forms=None,
                    enable_normalization: bool=True):
        """
        Получить лемму.
        
Severity: Minor
Found in rnnmorph/predictor.py - About 2 hrs 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 __normalize_for_gikrya has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def __normalize_for_gikrya(form):
        """
        Поучение леммы по правилам, максимально близким к тем, которые в корпусе ГИКРЯ.
        
        :param form: форма из pymorphy2.
Severity: Minor
Found in rnnmorph/predictor.py - About 1 hr 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 __init__ has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(self,
                 language="ru",
                 eval_model_config_path: str=None,
                 eval_model_weights_path: str=None,
                 gram_dict_input: str=None,
Severity: Minor
Found in rnnmorph/predictor.py - About 1 hr 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 __init__ has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(self,
Severity: Major
Found in rnnmorph/predictor.py - About 1 hr 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

      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

              There are no issues that match your filters.

              Category
              Status