acoustic_model/novoapi_for_python3x
2019-01-20 13:47:29 +01:00
..
asr The bug regarding novoapi for Python 3.6 is solved. The detail can be found in novoapi_for_python3x/readme.txt 2019-01-20 13:47:29 +01:00
backend The bug regarding novoapi for Python 3.6 is solved. The detail can be found in novoapi_for_python3x/readme.txt 2019-01-20 13:47:29 +01:00
utils/json The bug regarding novoapi for Python 3.6 is solved. The detail can be found in novoapi_for_python3x/readme.txt 2019-01-20 13:47:29 +01:00
__init__.py The bug regarding novoapi for Python 3.6 is solved. The detail can be found in novoapi_for_python3x/readme.txt 2019-01-20 13:47:29 +01:00
readme The bug regarding novoapi for Python 3.6 is solved. The detail can be found in novoapi_for_python3x/readme.txt 2019-01-20 13:47:29 +01:00

novoapi( https://bitbucket.org/novolanguage/python-novo-api ) is written in Python 2.7. 
To install it on Python 3.x the following points should be modified. 
- basestring --> str
- print xxx --> print({}.format(xxx)).
- import xxx --> from . import xxx
- except Exception, e --> except Exception as e
- remove tuples from input arguments of a function.
Concretely...

=== novoapi\backend\__init__.py
#import session
from . import session


=== novoapi\backend\session.py
#except Exception, e:
except Exception as e:

#print self.last_message
print(self.last_message)


=== novoapi\asr\__init__.py
#import segments
#import spraaklab
from . import segments
from . import spraaklab


=== novoapi\asr\segments\praat.py
#print_tier(output, "confidence", begin, end, confidences, ('%.3f', lambda x: x))
#print_tier(output, "words", begin, end, word_labels, ('%s', lambda x: x))
#print_tier(output, "phones", begin, end, phones, ('%s', lambda x: x))
print_tier(output, "confidence", begin, end, confidences, '%.3f', lambda x: x)
print_tier(output, "words", begin, end, word_labels, '%s', lambda x: x)
print_tier(output, "phones", begin, end, phones, '%s', lambda x: x)


=== novoapi\asr\spraaklab\__init__.py ===
#import schema
from . import schema


=== novoapi\asr\spraaklab\schema.py ===
#if isinstance(object, basestring):
if isinstance(object, str):

except jsonschema.ValidationError as e:
    #print data, "validated not OK", e.message
    print("{0} validated not OK {1}".format(data, e.message))
else:
    #print data, "validated OK"
    print("{0} validated OK".format(data))


Then to make it correctly work, few more modification is needed.
When the wav file is read using the wave module, the output (named buf) is a string of bytes on Python 2.7 while buf is a byte object on Python 3.6. 
Therefore... 

=== novoapi\backend\session.py
#audio_packet = str(buf[j:j + buffer_size])
audio_packet = buf[j:j + buffer_size]

Also, because of this difference, Segment.__repr__ (novoapi\asr\segments\segments.py) does not work.