<commit_before>/*eslint-env node*/

//------------------------------------------------------------------------------
// node.js starter application for Bluemix

// Blue Socks Chat Application Authors
// This application is based off of the socket.io chat example seen here (https://github.com/socketio/socket.io)
// Watson Tone Analyzer and SockBot implementation built by <NAME> (https://github.com/slkaczma)
// Language Translation implemented by <NAME> (https://github.com/odrodrig)
//------------------------------------------------------------------------------

var express = require('express');
var app = express();
var http = require('http').Server(app);
var io = require('socket.io')(http);

//Pull in Watson Developer Cloud library
var watson = require('watson-developer-cloud');

// cfenv provides access to your Cloud Foundry environment
// for more info, see: https://www.npmjs.com/package/cfenv
var cfenv = require('cfenv');

// get the app environment from Cloud Foundry
var appEnv = cfenv.getAppEnv();

/*********************************************************************************************************
                                           Parsing Service Credentials
*********************************************************************************************************/

//get services from environment variables
var services = appEnv.services;

console.log(services);

var username = "";
var password = "";

if(appEnv.isLocal) {
  console.log("Running Locally. Deploy to Bluemix for this app to work.");
} else {
  //If running in the cloud, then we will pull the service credentials from the environment variables
  console.log("Running in Cloud");
  var watsonCreds = services['language_translation'][0].credentials;
  var toneCreds = services['tone_analyzer'][0].credentials;
  var conversationCreds = services['conversation'][0].credentials;

  username = watsonCreds.username;
  password = watsonCreds.password;

  toneUser = toneCreds.username;
  tonePass = toneCreds.password;

  conversationUser = conversationCreds.username;
  conversationPass = <PASSWORD>;

}

var language_translation = watson.language_translation({<commit_msg>Fixing cred parsing error<commit_after>/*eslint-env node*/

//------------------------------------------------------------------------------
// node.js starter application for Bluemix

// Blue Socks Chat Application Authors
// This application is based off of the socket.io chat example seen here (https://github.com/socketio/socket.io)
// Watson Tone Analyzer and SockBot implementation built by <NAME> (https://github.com/slkaczma)
// Language Translation implemented by <NAME> (https://github.com/odrodrig)
//------------------------------------------------------------------------------

var express = require('express');
var app = express();
var http = require('http').Server(app);
var io = require('socket.io')(http);

//Pull in Watson Developer Cloud library
var watson = require('watson-developer-cloud');

// cfenv provides access to your Cloud Foundry environment
// for more info, see: https://www.npmjs.com/package/cfenv
var cfenv = require('cfenv');

// get the app environment from Cloud Foundry
var appEnv = cfenv.getAppEnv();

/*********************************************************************************************************
                                           Parsing Service Credentials
*********************************************************************************************************/

//get services from environment variables
var services = appEnv.services;

console.log("Begin services");
console.log(services);
console.log("End services");

var username = "";
var password = "";

if(appEnv.isLocal) {
  console.log("Running Locally. Deploy to Bluemix for this app to work.");
} else {
  //If running in the cloud, then we will pull the service credentials from the environment variables
  console.log("Running in Cloud");
  var watsonCreds = services['language_translator'][0].credentials;
  var toneCreds = services['tone_analyzer'][0].credentials;
  var conversationCreds = services['conversation'][0].credentials;

  username = watsonCreds.username;
  password = watsonCreds.password;

  toneUser = toneCreds.username;
  tonePass = toneCreds.password;

  conversationUser = conversationCreds.username;
  conversationPass = conversationCreds.password;

  console.log("Begin creds:");
  console.log(username);
  console.log(password);
  console.log(toneUser);
  console.log(tonePass);
  console.log(conversationUser);
  console.log(conversationPass);
  console.log("End creds");

}

var language_translation = watson.language_translation({
{'fraction_non_alphanumeric': 0.25659729671744264, 'fraction_numerical': 0.0012872774082814847, 'mean_word_length': 3.3815789473684212, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 8, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2022791', 'n_tokens_mistral': 1167, 'n_tokens_neox': 1124, 'n_words': 334}