<commit_before>define (require) ->
    # This module is a temporary solution to fetch pre-generated
    # accessibility sentences before we can access all the data allowing
    # them to be generated on demand.
    _        = require 'underscore'
    Raven    = require 'raven'
    Backbone = require 'backbone'

    models   = require 'cs!app/models'

    BASE_URL = 'https://www.hel.fi/palvelukarttaws/rest/v4/unit/'
    LANGUAGES = ['fi', 'sv', 'en']
    TIMEOUT = 10000

    _buildTranslatedObject = (data, base) ->
        _.object _.map(LANGUAGES, (lang) ->
            [lang, data["#{base}_#{lang}"]])

    currentId = 0
    ids = {}
    _generateId = (content) ->
        unless content of ids
            ids[content] = currentId
            currentId += 1
        ids[content]

    _parse = (data) ->
        sentences = { }
        groups = { }
        _.each data.accessibility_sentences, (sentence) ->
            group = _buildTranslatedObject sentence, 'sentence_group'
            key = _generateId group.fi
            groups[key] = group
            unless key of sentences
                sentences[key] = []
            sentences[key].push _buildTranslatedObject(sentence, 'sentence')
        groups:
            groups
        sentences:
            sentences

    fetchAccessibilitySentences = (unit, callback) ->
        args =
            dataType: 'jsonp'<commit_msg>Fix problem with jsonp response blocked in browsers because of CORB<commit_after>define (require) ->
    # This module is a temporary solution to fetch pre-generated
    # accessibility sentences before we can access all the data allowing
    # them to be generated on demand.
    _        = require 'underscore'
    Raven    = require 'raven'
    Backbone = require 'backbone'

    models   = require 'cs!app/models'

    BASE_URL = 'https://www.hel.fi/palvelukarttaws/rest/v4/unit/'
    LANGUAGES = ['fi', 'sv', 'en']
    TIMEOUT = 10000

    _buildTranslatedObject = (data, base) ->
        _.object _.map(LANGUAGES, (lang) ->
            [lang, data["#{base}_#{lang}"]])

    currentId = 0
    ids = {}
    _generateId = (content) ->
        unless content of ids
            ids[content] = currentId
            currentId += 1
        ids[content]

    _parse = (data) ->
        sentences = { }
        groups = { }
        _.each data.accessibility_sentences, (sentence) ->
            group = _buildTranslatedObject sentence, 'sentence_group'
            key = _generateId group.fi
            groups[key] = group
            unless key of sentences
                sentences[key] = []
            sentences[key].push _buildTranslatedObject(sentence, 'sentence')
        groups:
            groups
        sentences:
            sentences

    fetchAccessibilitySentences = (unit, callback) ->
        args =
            dataType: 'json'
{'fraction_non_alphanumeric': 0.10363059569968276, 'fraction_numerical': 0.005639760310186817, 'mean_word_length': 2.003174603174603, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '7640410', 'n_tokens_mistral': 828, 'n_tokens_neox': 785, 'n_words': 213}