wordless/wl_colligation_extractor.py
Avoid deeply nested control flow statements. Open
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,
Avoid deeply nested control flow statements. Open
Open
if settings_limit_searching == _tr('wl_colligation_extractor', 'None'):
tags_left = text.tags[max(0, i + window_left) : max(0, i + window_right + 1)]
else:
# Span positions (Left)
for position in range(max(0, i + window_left), max(0, i + window_right + 1)):
Avoid deeply nested control flow statements. Open
Open
if settings_limit_searching == _tr('wl_colligation_extractor', 'None'):
tags_right = text.tags[i + ngram_size + window_left - 1 : i + ngram_size + window_right]
else:
# Span positions (Right)
for position in range(i + ngram_size + window_left - 1, i + ngram_size + window_right):
Avoid deeply nested control flow statements. Open
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)
Avoid deeply nested control flow statements. Open
Open
if settings_limit_searching == _tr('wl_colligation_extractor', 'Within sentence segments'):
offsets_unit = offsets_sentence_segs
len_unit = len_sentence_segs
elif settings_limit_searching == _tr('wl_colligation_extractor', 'Within sentences'):
offsets_unit = offsets_sentences
Avoid deeply nested control flow statements. Open
Open
if settings_limit_searching == _tr('wl_colligation_extractor', 'None'):
tags_left = text.tags[max(0, i + window_left) : i]
tags_right = text.tags[i + ngram_size : i + ngram_size + window_right]
else:
# Span positions (Left)
Avoid deeply nested control flow statements. Open
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,
Avoid deeply nested control flow statements. Open
Open
for j, collocate in enumerate(reversed(tags_left)):
if wl_matching.check_context(
i, tokens,
context_settings = settings['search_settings']['context_settings'],
search_terms_incl = search_terms_incl,
Avoid deeply nested control flow statements. Open
Open
for j, collocate in enumerate(reversed(tags_left)):
if wl_matching.check_context(
i, tokens,
context_settings = settings['search_settings']['context_settings'],
search_terms_incl = search_terms_incl,
Avoid deeply nested control flow statements. Open
Open
if ngram == search_term:
colligations_freqs_file_filtered[(node, collocate)] = freqs