Function filterFromFull
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def filterFromFull(self):
""" Load the pre-processed full corpus and filter the vocabulary / sentences
to match the given model options
"""
- 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
TextData
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
class TextData:
"""Dataset class
Warning: No vocabulary limit
"""
Function _createBatch
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def _createBatch(self, samples):
"""Create a single batch from the list of sample. The batch size is automatically defined by the number of
samples given.
The inputs should already be inverted. The target should already have <go> and <eos>
Warning: This function should not make direct calls to args.batchSize !!!
- 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 loadCorpus
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def loadCorpus(self):
"""Load/create the conversations data
"""
datasetExist = os.path.isfile(self.filteredSamplesPath)
if not datasetExist: # First time we load the database: creating all files
- 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 sequence2str
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def sequence2str(self, sequence, clean=False, reverse=False):
"""Convert a list of integer into a human readable string
Args:
sequence (list<int>): the sentence to print
clean (Bool): if set, remove the <go>, <pad> and <eos> tokens
- 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 extractConversation
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def extractConversation(self, conversation):
"""Extract the sample lines from the conversations
Args:
conversation (Obj): a conversation object containing the lines to extract
"""
- 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"