<commit_before>angular.module('session', ['bbc.session'])
    .controller('SessionCtrl', function ($scope, $bbcSession) {
        $scope.dataMessages = [];

        $scope.clearData = function () {
            $scope.dataMessages = [];
        };

        $scope.getData = function () {

            if (typeof $scope.data === 'undefined' || typeof $scope.data.key === 'undefined' ||
                $scope.data.key.length === 0) {

                $scope.dataMessages.push('SENT: ' + 'get all session data');

                $bbcSession.getData(function (error, result) {
                    if (error) {
                        $scope.dataMessages.push(error);
                    }
                    else {
                        $scope.dataMessages.push('RESPONSE: ');
                        $scope.dataMessages.push(result);
                    }
                });
            }
            else {

                $scope.dataMessages.push('SENT: ' + 'get key: ' + $scope.data.key);

                $bbcSession.getData($scope.data.key, function (error, result) {
                    if (error) {
                        $scope.dataMessages.push(error);
                    }
                    else {
                        $scope.dataMessages.push('RESPONSE: ');
                        $scope.dataMessages.push(result);
                    }
                });
            }
        };

        $scope.setData = function () {
            if (typeof $scope.data === 'undefined' || typeof $scope.data.key === 'undefined' ||
                $scope.data.key.length === 0 || typeof $scope.data.value === 'undefined' ||
                $scope.data.value.length === 0) {

                $scope.dataMessages.push({class: 'error', message: 'ERROR: ' + 'for save in session is key and value required'});
            }
            else {

                $scope.dataMessages.push({class: 'sent', message: 'SENT: ' + 'setData' + 'key:' + $scope.data.key + ' value:' + $scope.data.value});

                if ($rootScope.socketEnabled) {
                    $rootScope.socketEnabled = false;
                }

                $bbcSession.setData($scope.data.key, $scope.data.value, function (error, result) {
                    if (error) {
                        $scope.activityMessages.push({class: 'error', message: error});
                    }
                    else {
                        $scope.dataMessages.push({class: 'response', message: 'RESPONSE: ' + result});
                    }
                });
            }
        };

        $scope.deleteData = function () {
            if (typeof $scope.data === 'undefined' || typeof $scope.data.key === 'undefined' ||
                $scope.data.key.length === 0) {

                $scope.dataMessages.push({class: 'sent', message: 'SENT: ' + 'set no key, delete all objects in session.data'});

                if ($rootScope.socketEnabled) {
                    $rootScope.socketEnabled = false;
                }

                $bbcSession.deleteData(function (error, result) {
                    if (error) {
                        $scope.activityMessages.push({class: 'error', message: error});
                    }
                    else {
                        $scope.dataMessages.push({class: 'response', message: 'RESPONSE: ' + result});
                    }
                });
            }
            else {

                $scope.dataMessages.push({class: 'sent', message: 'SENT: ' + 'delete ' + $scope.data.key + ' in session.data'});

                if ($rootScope.socketEnabled) {
                    $rootScope.socketEnabled = false;
                }

                $bbcSession.deleteData($scope.data.key, function (error, result) {
                    if (error) {
                        $scope.activityMessages.push({class: 'error', message: error});
                    }
                    else {
                        $scope.dataMessages.push({class: 'response', message: 'RESPONSE: ' + result});
                    }
                });
            }
        };
    });
<commit_msg>docs(session): update guide<commit_after>angular.module('session', ['bbc.session'])
    .controller('SessionCtrl', function ($scope, $bbcSession) {
        $scope.dataMessages = [];

        $scope.clearData = function () {
            $scope.dataMessages = [];
        };

        $scope.getData = function () {

            if (typeof $scope.data === 'undefined' || typeof $scope.data.key === 'undefined' ||
                $scope.data.key.length === 0) {

                $scope.dataMessages.push('SENT: ' + 'get all session data');

                $bbcSession.getData(function (error, result) {
                    if (error) {
                        $scope.dataMessages.push(error);
                    }
                    else {
                        $scope.dataMessages.push('RESPONSE: ');
                        $scope.dataMessages.push(result);
                    }
                });
            }
            else {

                $scope.dataMessages.push('SENT: ' + 'get key: ' + $scope.data.key);

                $bbcSession.getData($scope.data.key, function (error, result) {
                    if (error) {
                        $scope.dataMessages.push(error);
                    }
                    else {
                        $scope.dataMessages.push('RESPONSE: ');
                        $scope.dataMessages.push(result);
                    }
                });
            }
        };

        $scope.setData = function () {
            if (typeof $scope.data === 'undefined' || typeof $scope.data.key === 'undefined' ||
                $scope.data.key.length === 0 || typeof $scope.data.value === 'undefined' ||
                $scope.data.value.length === 0) {

                $scope.dataMessages.push('ERROR: ' +
                    'for save in session is key and value required');
            }
            else {

                $scope.dataMessages.push('SENT: ' + 'setData' + 'key:' + $scope.data.key +
                    ' value:' + $scope.data.value);

                $bbcSession.setData($scope.data.key, $scope.data.value, function (error, result) {
                    if (error) {
                        $scope.activityMessages.push(error);
                    }
                    else {
                        $scope.dataMessages.push('RESPONSE: ');
                        $scope.dataMessages.push(result);
                    }
                });
            }
        };

        $scope.deleteData = function () {
            if (typeof $scope.data === 'undefined' || typeof $scope.data.key === 'undefined' ||
                $scope.data.key.length === 0) {

                $scope.dataMessages.push('SENT: ' +
                    'set no key, delete all objects in session.data');

                $bbcSession.deleteData(function (error, result) {
                    if (error) {
                        $scope.activityMessages.push(error);
                    }
                    else {
                        $scope.dataMessages.push('RESPONSE: ');
                        $scope.dataMessages.push(result);
                    }
                });
            }
            else {

                $scope.dataMessages.push('SENT: ' + 'delete ' +
                    $scope.data.key + ' in session.data');

                $bbcSession.deleteData($scope.data.key, function (error, result) {
                    if (error) {
                        $scope.activityMessages.push(error);
                    }
                    else {
                        $scope.dataMessages.push('RESPONSE: ');
                        $scope.dataMessages.push(result);
                    }
                });
            }
        };
    });

{'fraction_non_alphanumeric': 0.13696876600102406, 'fraction_numerical': 0.0010240655401945725, 'mean_word_length': 1.1811836962590732, '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': '518179', 'n_tokens_mistral': 2060, 'n_tokens_neox': 1902, 'n_words': 322}