namebot/nlp.py
File nlp.py
has 319 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
"""Functions that use Natural Language Processing.
Word relationships found (via NLTK and other libraries)
to find and generate related words.
"""
Function _get_lemma_names
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
def _get_lemma_names(sub_synset, use_definitions=False):
"""Get lemma names."""
results = []
if sub_synset():
for v in sub_synset():
- Read upRead up
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 get_synsets
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
def get_synsets(words, use_definitions=False, clean=False):
"""Brute force loop on a synset ring to get all related words.
You are expected to filter or remove any that are not relevant separately,
if the resultant set is too long.
- Read upRead up
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"