PhonologicalCorpusTools / CorpusTools

Phonological CorpusTools
http://phonologicalcorpustools.github.io/CorpusTools/
GNU General Public License v3.0
111 stars 16 forks source link

[BUG] Negative phonological search crashes #797

Closed stannam closed 2 years ago

stannam commented 2 years ago

Describe the bug Phonological search crashes when the user selects all segments and runs negative search.

Sample corpus file 'example' corpus

To Reproduce

  1. Go to 'Phonological Search'
  2. Select all segments from the inventory
  3. Select 'negative'
  4. Run search
  5. See error

Expected behavior A result table with one row of N/A

Additional context Traceback (most recent call last): File "D:\PycharmProjects\CorpusTools\corpustools\gui\main.py", line 320, in do_check function(self) File "D:\PycharmProjects\CorpusTools\corpustools\gui\main.py", line 335, in do_check function(self) File "D:\PycharmProjects\CorpusTools\corpustools\gui\main.py", line 965, in phonoSearch 'Phonological search results', dialog, self) File "D:\PycharmProjects\CorpusTools\corpustools\gui\views.py", line 863, in init dataModel.setSummarized(True) File "D:\PycharmProjects\CorpusTools\corpustools\gui\models.py", line 633, in setSummarized self._summarize() File "D:\PycharmProjects\CorpusTools\corpustools\gui\models.py", line 589, in _summarize tokenfreq[segenvfilters] += line['Word'].frequency # and add token freq accordingly TypeError: unsupported operand type(s) for +=: 'float' and 'str'

Process finished with exit code 1

stannam commented 2 years ago

Tested on a very simple corpus with only two words. 'A' is a column for orthography, 'C' is for frequency.

A Transcription C
a a.a.a.a 1
b b 2
  1. Negative search for {a, b} (i.e., either [a] or [b]) -- expecting no words in the individual window but should have one row on the summary results
    • summary results image
  1. Negative search for [a] on top of Search 1
    • summary results image
  1. Negative search for [b] out of scratch
    • summary results image
  1. Positive search for [a] on top of Search 3 (just in case)
    • summary results image