Showing 6 of 6 total issues
Method parse_ngrams!
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def parse_ngrams!
unigram, bigram = nil, nil
read(ngrams_path) do |values|
values[0] = unigram unless values[0]
- 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
Method compute_interpolations!
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def compute_interpolations!
lambdas = [0.0, 0.0, 0.0]
unigram, bigram = nil, nil
- 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
Method read
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def read(path)
File.open(path) do |f|
until f.eof?
line = f.gets.chomp
next if line.empty? || line =~ /^%%/
- 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
Method each_trigram
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def each_trigram
table.each do |unigram, bigrams|
bigrams.each do |bigram, trigrams|
next unless bigram
- 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
Method forward_iteration
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def forward_iteration(pi, k, u, v, tags, word)
Method forward
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def forward(sentence)
pi, bp = Myaso::PiTable.new, Myaso::PiTable.new
pi[1, model.start_symbol, model.start_symbol] = 0.0
sentence.each_with_index.each_cons(3) do |(w1, i1), (w2, i2), (word, k)|
- 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"