<commit_before>"use strict";

/**
 * Clean the location JSON data. 
 *
 * Should become obsolete in the future when source spreadsheet/database 
 * and JSON generator have been enhanced.
 */
app.factory('LocationCleansingService', function(OpeningTimesService, UtilService) {

    var service = {};
    
    service.cleanLocations = function(locations) {
        for (var i = 0; i < locations.length; i++) {
            cleanLocation(locations[i]);
        }
    };
    
    function cleanLocation(location) {

        location.tags = getCleanTags(location.tags);
        
        var otPropertyNames = ["otSun", "otMon", "otTue", "otWed", "otThu", "otFri", "otSat"];
        
        for (var i = 0; i < otPropertyNames.length; i++) {
            var propertyName = otPropertyNames[i];
            location[propertyName] = getCleanOt(location[propertyName]);
        }
        
        if (location.website && location.website.length > 0) {
            location.website = getCleanWebsite(location.website);
        }
    }
    
    function getCleanTags(tags) {<commit_msg>Clean openComment<commit_after>"use strict";

/**
 * Clean the location JSON data. 
 *
 * Should become obsolete in the future when source spreadsheet/database 
 * and JSON generator have been enhanced.
 */
app.factory('LocationCleansingService', function(OpeningTimesService, UtilService) {

    var service = {};
    
    service.cleanLocations = function(locations) {
        for (var i = 0; i < locations.length; i++) {
            cleanLocation(locations[i]);
        }
    };
    
    function cleanLocation(location) {

        location.openComment = getCleanOpenComment(location.openComment);
        location.tags = getCleanTags(location.tags);
        
        var otPropertyNames = ["otSun", "otMon", "otTue", "otWed", "otThu", "otFri", "otSat"];
        
        for (var i = 0; i < otPropertyNames.length; i++) {
            var propertyName = otPropertyNames[i];
            location[propertyName] = getCleanOt(location[propertyName]);
        }
        
        if (location.website && location.website.length > 0) {
            location.website = getCleanWebsite(location.website);
        }
    }
    
    function getCleanOpenComment(openComment) {
    
        if (openComment) {
            openComment = openComment.trim();
            if (openComment.length === 0) {
                openComment = undefined;
            }
        }
        
        return openComment;
    }
    
    function getCleanTags(tags) {
{'fraction_non_alphanumeric': 0.11558389796731766, 'fraction_numerical': 0.0027899561578318055, 'mean_word_length': 2.3377659574468086, 'pattern_counts': {'":': 0, '<': 7, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '120962', 'n_tokens_mistral': 718, 'n_tokens_neox': 671, 'n_words': 156}