<commit_before>import json
from os.path import join, dirname
from watson_developer_cloud import SpeechToTextV1 as SpeechToText


speech_to_text = SpeechToText(username='YOUR SERVICE USERNAME',
                              password='<PASSWORD>')

print(json.dumps(speech_to_text.models(), indent=2))

with open(join(dirname(__file__), '../resources/speech.wav'), 'rb') as audio_file:
    print(json.dumps(speech_to_text.recognize(audio_file,
                                              content_type='audio/l16; rate=44100'), indent=2))
<commit_msg>Update speech_to_text_v1.py<commit_after>import json
from os.path import join, dirname
from watson_developer_cloud import SpeechToTextV1 as SpeechToText


speech_to_text = SpeechToText(username='YOUR SERVICE USERNAME',
                              password='<PASSWORD>')

print(json.dumps(speech_to_text.models(), indent=2))

with open(join(dirname(__file__), '../resources/speech.wav'), 'rb') as audio_file:
    print(json.dumps(speech_to_text.recognize(audio_file,
                                              content_type='audio/wav'), indent=2))

{'fraction_non_alphanumeric': 0.11161524500907441, 'fraction_numerical': 0.012704174228675136, 'mean_word_length': 3.34251968503937, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4912425', 'n_tokens_mistral': 352, 'n_tokens_neox': 327, 'n_words': 60}