<commit_before>(function() {

	var Helper = require('./helper.js');

	var Geocoder = require('./geocoder.js');

	/**
	* Geocoder Facotry
	*/
	var GeocoderFactory = {

		/**
		* Return an http adapter by name
		* @param  <string> adapterName adapter name
		* @return <object>
		*/
		_getHttpAdapter: function(adapterName) {

			if (adapterName === 'http') {
				var HttpAdapter = new require('./httpadapter/httpadapter.js');

				return new HttpAdapter(require('http'));
			}

			if (adapterName === 'https') {
				var HttpsAdapter = new require('./httpadapter/httpadapter.js');

				return new HttpsAdapter(require('https'));
			}
		},
		/**
		* Return a geocoder adapter by name
		* @param  <string> adapterName adapter name
		* @return <object>
		*/
		_getGeocoder: function(geocoderName, adapter, extra) {
			if (geocoderName === 'google') {
				var GoogleGeocoder = new require('./geocoder/googlegeocoder.js');

				return new GoogleGeocoder(adapter, {clientId: extra.clientId, apiKey: extra.apiKey, language: extra.language});
			}
            if (geocoderName === 'agol') {
                var AGOLGeocoder = new require('./geocoder/agolgeocoder.js');

                return new AGOLGeocoder(adapter, {client_id:extra.client_id, client_secret:extra.client_secret});
            }
			if (geocoderName === 'freegeoip') {
				var FreegeoipGeocoder = new require('./geocoder/freegeoipgeocoder.js');

				return new FreegeoipGeocoder(adapter);
			}
			if (geocoderName === 'datasciencetoolkit') {
				var DataScienceToolkitGeocoder = new require('./geocoder/datasciencetoolkitgeocoder.js');

				return new DataScienceToolkitGeocoder(adapter, {host: extra.host});
			}
			if (geocoderName === 'openstreetmap') {
				var OpenStreetMapGeocoder = new require('./geocoder/openstreetmapgeocoder.js');

				return new OpenStreetMapGeocoder(adapter, {language: extra.language});
			}
			if (geocoderName === 'mapquest') {
				var MapQuestGeocoder = new require('./geocoder/mapquestgeocoder.js');

				return new MapQuestGeocoder(adapter, extra.apiKey);
			}
			if (geocoderName === 'openmapquest') {
				var OpenMapQuestGeocoder = new require('./geocoder/openmapquestgeocoder.js');

				return new OpenMapQuestGeocoder(adapter, extra.apiKey);
			}
			if (geocoderName === 'nominatimmapquest') {
				var NominatimMapquestGeocoder = new require('./geocoder/nominatimmapquestgeocoder.js');

				return new NominatimMapquestGeocoder(adapter, {language: extra.language});
			}
			if (geocoderName === 'tomtom') {
				var TomTomGeocoder = new require('./geocoder/tomtomgeocoder.js');

				return new TomTomGeocoder(adapter, {apiKey: extra.apiKey});
			}
      if (geocoderName === 'smartystreets') {
        var SmartyStreets = new require('./geocoder/smartystreetsgeocoder.js');

        return new SmartyStreets(adapter, extra.auth_id, extra.auth_token);
      }

			throw new Error('No geocoder provider find for : ' + geocoderName);
		},
		/**
		* Return an formatter adapter by name
		* @param  <string> adapterName adapter name
		* @return <object>
		*/
		_getFormatter: function(formatterName, extra) {
			if (formatterName === 'gpx') {
				var GpxFormatter = new require('./formatter/gpxformatter.js');

				return new GpxFormatter();
			}

			if (formatterName === 'string') {
				var StringFormatter = new require('./formatter/stringformatter.js');

				return new StringFormatter(extra.formatterPattern);
			}
		},
		/**
		* Return a geocoder
		* @param  <string|object> geocoderAdapter Geocoder adapter name or adapter object
		* @param  <string|object> httpAdapter     Http adapter name or adapter object
		* @param  <array>         extra           Extra parameters array
		* @return <object>
		*/
		getGeocoder: function(geocoderAdapter, httpAdapter, extra) {

			if (!httpAdapter || httpAdapter === 'undefined') {
				httpAdapter = 'http';
			}

			if (!extra || extra == 'undefinded') {
				extra = {};
			}

			if (Helper.isString(httpAdapter)) {
				httpAdapter = this._getHttpAdapter(httpAdapter);
			}

			if (Helper.isString(geocoderAdapter)) {
				geocoderAdapter = this._getGeocoder(geocoderAdapter, httpAdapter, extra);
			}

			formatter = extra.formatter;

			if (Helper.isString(formatter)) {
				formatter = this._getFormatter(formatter, extra);
			}

			var geocoder = new Geocoder(geocoderAdapter, formatter);

			return geocoder;
		}

	};

	module.exports = GeocoderFactory;

})();
<commit_msg>Added OpenCage to the factory list<commit_after>(function() {

	var Helper = require('./helper.js');

	var Geocoder = require('./geocoder.js');

	/**
	* Geocoder Facotry
	*/
	var GeocoderFactory = {

		/**
		* Return an http adapter by name
		* @param  <string> adapterName adapter name
		* @return <object>
		*/
		_getHttpAdapter: function(adapterName) {

			if (adapterName === 'http') {
				var HttpAdapter = new require('./httpadapter/httpadapter.js');

				return new HttpAdapter(require('http'));
			}

			if (adapterName === 'https') {
				var HttpsAdapter = new require('./httpadapter/httpadapter.js');

				return new HttpsAdapter(require('https'));
			}
		},
		/**
		* Return a geocoder adapter by name
		* @param  <string> adapterName adapter name
		* @return <object>
		*/
		_getGeocoder: function(geocoderName, adapter, extra) {
			if (geocoderName === 'google') {
				var GoogleGeocoder = new require('./geocoder/googlegeocoder.js');

				return new GoogleGeocoder(adapter, {clientId: extra.clientId, apiKey: extra.apiKey, language: extra.language});
			}
            if (geocoderName === 'agol') {
                var AGOLGeocoder = new require('./geocoder/agolgeocoder.js');

                return new AGOLGeocoder(adapter, {client_id:extra.client_id, client_secret:extra.client_secret});
            }
			if (geocoderName === 'freegeoip') {
				var FreegeoipGeocoder = new require('./geocoder/freegeoipgeocoder.js');

				return new FreegeoipGeocoder(adapter);
			}
			if (geocoderName === 'datasciencetoolkit') {
				var DataScienceToolkitGeocoder = new require('./geocoder/datasciencetoolkitgeocoder.js');

				return new DataScienceToolkitGeocoder(adapter, {host: extra.host});
			}
			if (geocoderName === 'openstreetmap') {
				var OpenStreetMapGeocoder = new require('./geocoder/openstreetmapgeocoder.js');

				return new OpenStreetMapGeocoder(adapter, {language: extra.language});
			}
			if (geocoderName === 'mapquest') {
				var MapQuestGeocoder = new require('./geocoder/mapquestgeocoder.js');

				return new MapQuestGeocoder(adapter, extra.apiKey);
			}
			if (geocoderName === 'openmapquest') {
				var OpenMapQuestGeocoder = new require('./geocoder/openmapquestgeocoder.js');

				return new OpenMapQuestGeocoder(adapter, extra.apiKey);
			}
			if (geocoderName === 'opencage') {
				var OpenCageGeocoder = new require('./geocoder/opencagegeocoder.js');
				return new OpenCageGeocoder(adapter, extra.apiKey, extra);
			}
			if (geocoderName === 'nominatimmapquest') {
				var NominatimMapquestGeocoder = new require('./geocoder/nominatimmapquestgeocoder.js');

				return new NominatimMapquestGeocoder(adapter, {language: extra.language});
			}
			if (geocoderName === 'tomtom') {
				var TomTomGeocoder = new require('./geocoder/tomtomgeocoder.js');

				return new TomTomGeocoder(adapter, {apiKey: extra.apiKey});
			}
      if (geocoderName === 'smartystreets') {
        var SmartyStreets = new require('./geocoder/smartystreetsgeocoder.js');

        return new SmartyStreets(adapter, extra.auth_id, extra.auth_token);
      }

			throw new Error('No geocoder provider find for : ' + geocoderName);
		},
		/**
		* Return an formatter adapter by name
		* @param  <string> adapterName adapter name
		* @return <object>
		*/
		_getFormatter: function(formatterName, extra) {
			if (formatterName === 'gpx') {
				var GpxFormatter = new require('./formatter/gpxformatter.js');

				return new GpxFormatter();
			}

			if (formatterName === 'string') {
				var StringFormatter = new require('./formatter/stringformatter.js');

				return new StringFormatter(extra.formatterPattern);
			}
		},
		/**
		* Return a geocoder
		* @param  <string|object> geocoderAdapter Geocoder adapter name or adapter object
		* @param  <string|object> httpAdapter     Http adapter name or adapter object
		* @param  <array>         extra           Extra parameters array
		* @return <object>
		*/
		getGeocoder: function(geocoderAdapter, httpAdapter, extra) {

			if (!httpAdapter || httpAdapter === 'undefined') {
				httpAdapter = 'http';
			}

			if (!extra || extra == 'undefinded') {
				extra = {};
			}

			if (Helper.isString(httpAdapter)) {
				httpAdapter = this._getHttpAdapter(httpAdapter);
			}

			if (Helper.isString(geocoderAdapter)) {
				geocoderAdapter = this._getGeocoder(geocoderAdapter, httpAdapter, extra);
			}

			formatter = extra.formatter;

			if (Helper.isString(formatter)) {
				formatter = this._getFormatter(formatter, extra);
			}

			var geocoder = new Geocoder(geocoderAdapter, formatter);

			return geocoder;
		}

	};

	module.exports = GeocoderFactory;

})();

{'fraction_non_alphanumeric': 0.1327943293830989, 'fraction_numerical': 0.0, 'mean_word_length': 3.6236559139784945, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '5411367', 'n_tokens_mistral': 3364, 'n_tokens_neox': 2855, 'n_words': 611}