<commit_before>import Promise = require('bluebird');
import {Inject} from "di-ts";
import {IEvseGeoCoordinates} from "../interfaces/soap/IEvseGeoCoordinates";
import {IEnum} from "../interfaces/models/IEnum";
import {IEvseDataRecord} from "../interfaces/soap/IEvseDataRecord";
import {IOperator} from "../interfaces/models/IOperator";
import {IEVSEChargingFacility} from "../interfaces/models/IEVSEChargingFacility";
const CountryLanguage = require('country-language');

@Inject
export class DataImportHelper {

  /**
   * Returns enum id by specified option string and enum objects.
   * @throws Error, if no match is found in specified enum objects
   */
  getEnumIdByString(enums: IEnum[], enumOption: string): number {

    for (let _enum of enums) {

      if (_enum.option === enumOption) {

        return _enum.id;<commit_msg>more tolerance for enum identification<commit_after>import Promise = require('bluebird');
import {Inject} from "di-ts";
import {IEvseGeoCoordinates} from "../interfaces/soap/IEvseGeoCoordinates";
import {IEnum} from "../interfaces/models/IEnum";
import {IEvseDataRecord} from "../interfaces/soap/IEvseDataRecord";
import {IOperator} from "../interfaces/models/IOperator";
import {IEVSEChargingFacility} from "../interfaces/models/IEVSEChargingFacility";
const CountryLanguage = require('country-language');

@Inject
export class DataImportHelper {

  /**
   * Returns enum id by specified option string and enum objects.
   * @throws Error, if no match is found in specified enum objects
   */
  getEnumIdByString(enums: IEnum[], enumOption: string): number {

    if (enumOption) {

      for (let _enum of enums) {

        // why "toLowerCase"? for more tolerance;
        // some enumOption values differ from specified
        // case
        if (_enum.option.toLowerCase() === enumOption.toLowerCase()) {

          return _enum.id;
        }
{'fraction_non_alphanumeric': 0.12221041445270989, 'fraction_numerical': 0.0, 'mean_word_length': 4.0754716981132075, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4526336', 'n_tokens_mistral': 547, 'n_tokens_neox': 552, 'n_words': 157}