wordless/wl_nlp/wl_texts.py
Function to_tokens
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def to_tokens(
Function __init__
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(
Consider simplifying this complex logical expression. Open
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))
):
Avoid deeply nested control flow statements. Open
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:
Avoid deeply nested control flow statements. Open
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()
Avoid deeply nested control flow statements. Open
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())
Avoid deeply nested control flow statements. Open
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([[]])
Avoid deeply nested control flow statements. Open
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())