BLKSerene/Wordless

View on GitHub

Showing 207 of 207 total issues

Avoid deeply nested control flow statements.
Open

                for file_type, trs in TRS_FILE_TYPES.items():
                    if tr == file_type:
                        tr = trs[0]

                        break
Severity: Major
Found in utils/wl_trs_translate.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                                for j, collocate in enumerate(tags_right):
                                    if wl_matching.check_context(
                                        i, tokens,
                                        context_settings = settings['search_settings']['context_settings'],
                                        search_terms_incl = search_terms_incl,
    Severity: Major
    Found in wordless/wl_colligation_extractor.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          if prefer_raw:
                              # Always use original tokens
                              results_modified.extend(tokens_raw_temp)
                          # eg. POS tagging
                          else:
      Severity: Major
      Found in wordless/wl_nlp/wl_nlp_utils.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if re_match(search_term, token_search.display_text(), flags = re_flags):
                                search_results.add(token)
        
                    # Match inflected forms of search terms and search results
                    if settings['match_inflected_forms']:
        Severity: Major
        Found in wordless/wl_nlp/wl_matching.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              for i, token in enumerate(sentence_seg):
                                  if wl_checks_tokens.is_num(token):
                                      sentence_seg[i] = ''
          
              # Filter stop words
          Severity: Major
          Found in wordless/wl_nlp/wl_token_processing.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                for sentence in doc.sents:
                                    displacy_dict = spacy.displacy.parse_deps(sentence, options = options)
            
                                    if token_properties:
                                        for token, word in zip(sentence, displacy_dict['words']):
            Severity: Major
            Found in wordless/wl_nlp/wl_dependency_parsing.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                          if text.lang in self.main.settings_global['sentiment_analyzers']:
                                              sentiment_inputs.append(' '.join(
                                                  [*left_tokens_search, *node_tokens_search, *right_tokens_search]
                                              ))
              
              
              Severity: Major
              Found in wordless/wl_concordancer.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                            for j in range(11):
                                                self.set_item_err(row + j, i, text = self.tr('No language support'), alignment_hor = 'right')
                
                
                Severity: Major
                Found in wordless/wl_profiler.py - About 45 mins to fix

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

                      def __init__(
                  Severity: Minor
                  Found in wordless/wl_widgets/wl_lists.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                        for item in range(100):
                                            item = wl_texts.Wl_Token(str(item))
                                            freq_1, freq_2 = random.sample(range(100), 2)
                    
                                            freq_files_items[item] = [
                    Severity: Major
                    Found in tests/tests_figs/test_figs_freqs.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                          for sentence_seg in sentence:
                                              for token in sentence_seg:
                                                  head = token.head
                      
                                                  for i_sentence_seg, sentence_seg in enumerate(sentence):
                      Severity: Major
                      Found in wordless/wl_nlp/wl_token_processing.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                            for sentence in doc.sentences:
                                                for token in sentence.words:
                                                    texts_tagged.append(token.text)
                        
                                                    if tagset in ['default', 'raw']:
                        Severity: Major
                        Found in wordless/wl_nlp/wl_pos_tagging.py - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                      for token in copy.deepcopy(parallel_unit):
                                                          parallel_unit_tokens_search.append(token)
                          
                                                          if token.punc_mark:
                                                              parallel_unit_tokens_search.append(wl_texts.Wl_Token(token.punc_mark, lang = token.lang))
                          Severity: Major
                          Found in wordless/wl_concordancer_parallel.py - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                        if not self.isRowHidden(row):
                                                            item = self.model().item(row, col)
                            
                                                            item.setText(f'{item.val:.{precision_decimals}}')
                                                # Percentages
                            Severity: Major
                            Found in wordless/wl_widgets/wl_tables.py - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                          if freqs_totals[j][k]:
                                                              self.set_item_num(i, cols_freqs_start[j] + k * 2 + 1, freq / freqs_totals[j][k])
                                                          else:
                                                              self.set_item_num(i, cols_freqs_start[j] + k * 2 + 1, 0)
                              
                              
                              Severity: Major
                              Found in wordless/wl_colligation_extractor.py - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                            if ngram == search_term:
                                                                colligations_freqs_file_filtered[(node, collocate)] = freqs
                                
                                
                                Severity: Major
                                Found in wordless/wl_colligation_extractor.py - About 45 mins 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 doc in nlp.pipe(docs):
                                                            for token in doc:
                                                                texts_tagged.append(token.text)
                                    
                                                                if tagset in ['default', 'raw']:
                                    Severity: Major
                                    Found in wordless/wl_nlp/wl_pos_tagging.py - About 45 mins to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                                                  for k, ngram in enumerate(wl_nlp_utils.ngrams(tokens, len_search_term)):
                                                                      if ngram == search_term:
                                                                          points.append([x_start + k / text.num_tokens * len_tokens_total, y_start - j])
                                                                          # Total
                                                                          points.append([x_start_total + k, 0])
                                      Severity: Major
                                      Found in wordless/wl_concordancer.py - About 45 mins to fix

                                        Avoid deeply nested control flow statements.
                                        Open

                                                                    if not self.isRowHidden(row):
                                                                        item = self.model().item(row, col)
                                        
                                                                        val_cum += item.val
                                                                        item.setText(f'{val_cum:.{precision_pcts}%}')
                                        Severity: Major
                                        Found in wordless/wl_widgets/wl_tables.py - About 45 mins to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language