Skip to content

Commit

Permalink
fix for #797
Browse files Browse the repository at this point in the history
the error arose when generating rows for summary results. Each row in the summary results has frequency which is calculated on the fly. However, if a search does not have any hit, the freq is N/A, raising type error. This problem has been dealt with for the positive search but not for the negative the current commit solves this issue.
  • Loading branch information
stannam committed Jan 18, 2022
1 parent 60af204 commit 68744de
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions corpustools/gui/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,10 @@ def _summarize(self):
typefreq[segenvfilters] += 0
tokenfreq[segenvfilters] += 0
elif res_type == 'negative': # if negative search
if line['Word'].transcription is None:
typefreq[segenvfilters] += 0 # check first if the negative search has no hit
tokenfreq[segenvfilters] += 0
continue
typefreq[segenvfilters] += 1 # the word is in the result for NOT satisfying the env[i] so +1
tokenfreq[segenvfilters] += line['Word'].frequency # and add token freq accordingly

Expand Down

0 comments on commit 68744de

Please sign in to comment.