<commit_before>var ArchetypeLabels = (function() {

    //private vars
    var isEntityLookupLoading = false;
    var entityCache = [];

    //private functions
    function getEntityById(scope, id, type) {

        var cachedEntity = _.find(entityCache, function (e){
            return e.id == id;
        });

        if(cachedEntity) {
            return cachedEntity;
        }

        //go get it from server
        if (!isEntityLookupLoading) {
            isEntityLookupLoading = true;

            scope.resources.entityResource.getById(id, type).then(function(entity) {

                entityCache.push(entity);

                isEntityLookupLoading = false;

                return entity;
            });
        }

        return null;
    }

    //public functions
    return {
        GetEntityProperty: function (value, scope, args) {

            if(!args) {
                args = {entityType: "Document", propertyName: "name"}
            }

            if (value) {
                //if handed a csv list, take the first only
                var id = value.split(",")[0];

                if (id) {
                    var entity = getEntityById(scope, id, args.entityType);

                    if(entity) {
                        return entity[args.propertyName];
                    }
                }
            }

            return "";
        },
        UrlPickerTitle: function(value, scope, args) {

            if(!args) {
                args = {propertyName: "name"}
            }

            var entity;<commit_msg>Handle arg detection better and change UrlPicker functionname<commit_after>var ArchetypeLabels = (function() {

    //private vars
    var isEntityLookupLoading = false;
    var entityCache = [];

    //private functions
    function getEntityById(scope, id, type) {

        var cachedEntity = _.find(entityCache, function (e){
            return e.id == id;
        });

        if(cachedEntity) {
            return cachedEntity;
        }

        //go get it from server
        if (!isEntityLookupLoading) {
            isEntityLookupLoading = true;

            scope.resources.entityResource.getById(id, type).then(function(entity) {

                entityCache.push(entity);

                isEntityLookupLoading = false;

                return entity;
            });
        }

        return null;
    }

    //public functions
    return {
        GetEntityProperty: function (value, scope, args) {

           if(!args.entityType) {
                args = {entityType: "Document", propertyName: "name"}
            }

            if (value) {
                //if handed a csv list, take the first only
                var id = value.split(",")[0];

                if (id) {
                    var entity = getEntityById(scope, id, args.entityType);

                    if(entity) {
                        return entity[args.propertyName];
                    }
                }
            }

            return "";
        },
        UrlPicker: function(value, scope, args) {

            if(!args.propertyName) {
                args = {propertyName: "name"}
            }

            var entity;
{'fraction_non_alphanumeric': 0.09943360604153556, 'fraction_numerical': 0.0006293266205160479, 'mean_word_length': 1.3495934959349594, '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': '1433019', 'n_tokens_mistral': 830, 'n_tokens_neox': 762, 'n_words': 194}