<commit_before>ngapp.service('xelibService', function() {
    let service = this;

    this.getExceptionInformation = function() {
        try {
            console.log(xelib.GetMessages());
            console.log(xelib.GetExceptionMessage());
        } catch (e) {
            console.log("Failed to get exception information: " + e);
        }
    };

    this.printGlobals = function() {
        try {
            console.log(xelib.GetGlobals());
        } catch (e) {
            console.log(e);
            service.getExceptionInformation();
        }
    };

    this.startSession = function(profile) {
        xelib.SetGamePath(profile.gamePath);
        xelib.SetLanguage(profile.language);
        xelib.SetGameMode(profile.gameMode);
    };
});<commit_msg>added fixReferences function to xelibService<commit_after>ngapp.service('xelibService', function() {
    let service = this;

    this.getExceptionInformation = function() {
        try {
            console.log(xelib.GetMessages());
            console.log(xelib.GetExceptionMessage());
        } catch (e) {
            console.log("Failed to get exception information: " + e);
        }
    };

    this.printGlobals = function() {
        try {
            console.log(xelib.GetGlobals());
        } catch (e) {
            console.log(e);
            service.getExceptionInformation();
        }
    };

    this.startSession = function(profile) {
        xelib.SetGamePath(profile.gamePath);
        xelib.SetLanguage(profile.language);
        xelib.SetGameMode(profile.gameMode);
    };

    let getFormIds = function(records) {
        return records.map((record) => { return xelib.GetFormID(record) });
    };

    this.fixReferences = function(oldRecords, newRecords) {
        let oldFormIds = getFormIds(oldRecords),
            newFormIds = getFormIds(newRecords);
        newRecords.forEach(function(newRecord) {
            oldFormIds.forEach(function(oldFormId, index) {
                let newFormId = newFormIds[index];
                xelib.ExchangeReferences(newRecord, oldFormId, newFormId);
            })
        });
    };
});
{'fraction_non_alphanumeric': 0.12417374881964117, 'fraction_numerical': 0.0, 'mean_word_length': 2.2057488653555217, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '7378692', 'n_tokens_mistral': 618, 'n_tokens_neox': 603, 'n_words': 90}