Skip to content

Commit

Permalink
change guard for number of ranks
Browse files Browse the repository at this point in the history
num in Summarize function is number of wanted sentences, because need to check len(Ranks) instead of len(Ranks)-1
  • Loading branch information
zeslava committed Jan 31, 2019
1 parent 0e596a0 commit d6d57da
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tldr.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func (bag *Bag) Summarize(text string, num int) (string, error) {

// guard so it won't crash but return only the highest rank sentence
// if num is invalid
if num > (len(bag.Ranks)-1) || num < 1 {
if num > len(bag.Ranks) || num < 1 {
num = 1
}

Expand Down

0 comments on commit d6d57da

Please sign in to comment.