BLKSerene/Wordless

View on GitHub
wordless/wl_nlp/wl_texts.py

Summary

Maintainability
C
7 hrs
Test Coverage

Function to_tokens has 9 arguments (exceeds 4 allowed). Consider refactoring.
Open

def to_tokens(
Severity: Major
Found in wordless/wl_nlp/wl_texts.py - About 1 hr to fix

    Function __init__ has 9 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(
    Severity: Major
    Found in wordless/wl_nlp/wl_texts.py - About 1 hr to fix

      Consider simplifying this complex logical expression.
      Open

                  if (
                      self.tokenized
                      and (css_para and css_sentence and css_word)
                      and (soup.select_one(css_para) and soup.select_one(css_sentence) and soup.select_one(css_word))
                  ):
      Severity: Major
      Found in wordless/wl_nlp/wl_texts.py - About 1 hr to fix

        Avoid deeply nested control flow statements.
        Open

                                if (para := para[tag_end:]):
                                    tags_tokens = self.add_tags_splitting(para, tags_tokens)
        
                    # Add empty tags for untagged files
                    if not self.tagged:
        Severity: Major
        Found in wordless/wl_nlp/wl_texts.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  for tag in re.finditer(re_tags, para):
                                      tags_tokens = self.add_tags_splitting(para[tag_end:tag.start()], tags_tokens)
                                      tags_tokens[-1].append(tag.group())
          
                                      tag_end = tag.end()
          Severity: Major
          Found in wordless/wl_nlp/wl_texts.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    for sentence in wl_sentence_tokenization.wl_sentence_split(self.main, text_no_tags):
                                        self.tokens_multilevel[-1].append([])
            
                                        for sentence_seg in wl_sentence_tokenization.wl_sentence_seg_split(self.main, sentence):
                                            self.tokens_multilevel[-1][-1].append(sentence_seg.split())
            Severity: Major
            Found in wordless/wl_nlp/wl_texts.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if i == 0 and re.match(re_tags_start, para):
                                          # Check if the first paragraph is empty
                                          if not self.tokens_multilevel[0]:
                                              self.tokens_multilevel[0].append([[]])
              
              
              Severity: Major
              Found in wordless/wl_nlp/wl_texts.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        for sentence in wl_sentence_tokenization.wl_sentence_split(self.main, para):
                                            self.tokens_multilevel[-1].append([])
                
                                            for sentence_seg in wl_sentence_tokenization.wl_sentence_seg_split(self.main, sentence):
                                                self.tokens_multilevel[-1][-1].append(sentence_seg.split())
                Severity: Major
                Found in wordless/wl_nlp/wl_texts.py - About 45 mins to fix

                  There are no issues that match your filters.

                  Category
                  Status