[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Problem with ruby-espeak and CSV.parse changes



Hi there,

the newly accepted ruby-espeak (one of the Kali packages) fails to test
successfully with Ruby2.7. The reason seems that CSV.parse() has a behavior
change. It does not parse the file test/fixtures/voices.txt anymore as it did.
It seems using 

col_sep: ' '

is now interpreted literally. So fields separated by more then one space are
not parsed as columns in a row. To demonstrate consider this line:

> Pty Language Age/Gender VoiceName       File        Other Langs
>  5  af             M  afrikaans         af          

With ruby2.5 it is parsed like this:

> #<CSV::Row "Pty":"5" "Language":"af" "Age/Gender":"M" "VoiceName":"afrikaans"
> "File":"af" "Other":nil "Langs":nil>

and with ruby2.7 like this:

> #<CSV::Row "Pty":nil "Language":"5" "Age/Gender":nil "VoiceName":"af" nil:nil
> nil:nil nil:nil nil:nil nil:nil nil:nil "File":nil nil:nil nil:nil nil:nil
> nil:nil nil:nil nil:"M" nil:nil "Other":"afrikaans" "Langs":nil nil:nil
> nil:nil nil:nil nil:nil nil:nil nil:nil nil:nil nil:"af" nil:nil nil:nil
> nil:nil nil:nil nil:nil nil:nil nil:nil nil:nil nil:nil nil:nil>

This seems intentional:
https://github.com/ruby/csv/issues/67
https://github.com/ruby/csv/commit/7798df60fed87251b26c1202eb251a7894b55469#diff-fd263cdff2717a557bddf1592762dba3R16

The file format is determined by the output of `espeak --voices` and cannot be
changed.

Does anybody know, how to easily fix this, or is anybody up to add some magic
to lib/espeak/voice.rb to deal with this?

Regards, Daniel

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: