PhonologicalCorpusTools / CorpusTools

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

Frequency of alternation throws error with phonological edit distance using transcriptions #79

Closed mmcauliffe closed 10 years ago

mmcauliffe commented 10 years ago

When running frequency of alternations using Phonological edit distance, selecting "Compare transcription" instead of "Compare spelling" causes the following error:

Exception in Tkinter callback Traceback (most recent call last): File "C:\Python34\lib\tkinterinit.py", line 1487, in call return self.func(_args) File "C:\Users\SpeechInContext\Documents\GitHub\CorpusTools\corpustools\gui\fagui.py", line 148, in calculate_freq_of_alt min_rel=min_rel, max_rel=max_rel, min_pairs_okay=min_pairs_ok) File "C:\Users\SpeechInContext\Documents\GitHub\CorpusTools\corpustools\freqalt\freq_of_alt.py", line 92, in calc_freq_of_alt alignment = al.align(w1, w2) File "C:\Users\SpeechInContext\Documents\GitHub\CorpusTools\corpustools\symbolsim\phono_align_ex.py", line 32, in align similarity_matrix = self.make_similarity_matrix(seq1, seq2) File "C:\Users\SpeechInContext\Documents\GitHub\CorpusTools\corpustools\symbolsim\phono_align_ex.py", line 64, in make_similarity_matrix d[0][y]['f'] = d[0][y-1]['f'] + self.compare_segments('empty', seq2[y-1]) File "C:\Users\SpeechInContext\Documents\GitHub\CorpusTools\corpustools\symbolsim\phono_align_ex.py", line 113, in comparesegments fs2 = self.features[segment2symbol] KeyError: ''

Should there even be the choice of doing phonological edit distance on spelling? I'm assuming that it uses the Transcription anyway.

mdfry commented 10 years ago

There is somewhat of a point in that if someone wants to input spelling, have the system automatically find the transcription, and then output the phonological edit distance on that.

You're right in that doing phonological edit distance on actual spelling makes no sense whatsoever. I'll add some error handling to deal with when there are no transcriptions available

kchall commented 10 years ago

Can't we just grey out the option for "spelling" for "phonological" edit distance? They're always entering the spelling, even if they're using a transcription-based algorithm.

mdfry commented 10 years ago

We could - but I thinking about it, are you ever going to want to calculate the frequency of alternation on orthography anyways? It might make more sense to just remove the option of using freq_of_alt on spelling whatsoever, and only allow it with transcrpition

mdfry commented 10 years ago

but thinking about it\ not "but I thinking about it"

kchall commented 10 years ago

I get the same error as Michael M. whenever I try to calculate F. of A. with phonological edit distance.

Yes, if phonological alignment goes in to the determination of frequency of alternation, then we're never using spelling, so that can be taken out.

mdfry commented 10 years ago

Updated the scripts so they no longer call errors. The problem was caused by a mistake in getting the transcription for display purposes. It should be all cleared up now