<commit_before>'use strict';

/**
 *
 * @constructor
 * @param {Object} _options configuration parameters
 * @param {String} _options.url  resource URL
 *
 */
function SpeechSynthesis (_options) {

	var options = _options || {
		// TODO: change to production server when released
		url: 'https://stream-d.watsonplatform.net/text-to-speech-beta/api/v1'
	}

	this._url = options.url;
	this._api_key = options.api_key;
	this._audioElement = options.audioElement;
	this._voices = [];

	var xhr = new XMLHttpRequest();
	xhr.open('GET', this._url + '/voices', true);
	xhr.setRequestHeader('X-Watson-DPAT-Token', this._api_key ? this._api_key : '');
	xhr.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
	xhr.onreadystatechange = function() {
		if (xhr.readyState === 4) {
			this._voices = JSON.parse(xhr.responseText).voices;
			this.onvoiceschanged();
		}
	}.bind(this);<commit_msg>Add proper file header to speechsynthesis.js<commit_after>'use strict';

/**
 * Copyright 2014 IBM Corp. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 *
 * SpeechSynthesis prototype per W3C Speech spec:
 * https://dvcs.w3.org/hg/speech-api/raw-file/tip/webspeechapi.html
 *
 * @author <NAME> <<EMAIL>>
 * @constructor
 * @param {Object} _options configuration parameters
 * @param {String} _options.url  resource URL
 *
 */
function SpeechSynthesis (_options) {

	var options = _options || {
		// TODO: change to production server when released
		url: 'https://stream-d.watsonplatform.net/text-to-speech-beta/api/v1'
	}

	this._url = options.url;
	this._api_key = options.api_key;
	this._audioElement = options.audioElement;
	this._voices = [];

	var xhr = new XMLHttpRequest();
	xhr.open('GET', this._url + '/voices', true);
	xhr.setRequestHeader('X-Watson-DPAT-Token', this._api_key ? this._api_key : '');
	xhr.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
	xhr.onreadystatechange = function() {
		if (xhr.readyState === 4) {
			this._voices = JSON.parse(xhr.responseText).voices;
			this.onvoiceschanged();
		}
	}.bind(this);
{'fraction_non_alphanumeric': 0.1381705905055963, 'fraction_numerical': 0.0061752219220378235, 'mean_word_length': 4.132673267326733, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 3, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '333411', 'n_tokens_mistral': 878, 'n_tokens_neox': 824, 'n_words': 213}