<commit_before><?php
/**
 * Smarty plugin
 * @package Smarty
 * @subpackage plugins
 */


/**
 * Smarty capitalize modifier plugin
 *
 * Type:     modifier<br>
 * Name:     capitalize<br>
 * Purpose:  capitalize words in the string
 * @link http://smarty.php.net/manual/en/language.modifiers.php#LANGUAGE.MODIFIER.CAPITALIZE
 *      capitalize (Smarty online manual)
 * @param string
 * @return string
 */
function smarty_modifier_capitalize($string)
{
    return preg_replace_callback('!\b\w+\b!', 'smarty_modifier_capitalize_ucfirst', $string);    
}

function smarty_modifier_capitalize_ucfirst($string)
{
    if(!preg_match('!\d!',$string[0]))
        return ucfirst($string[0]);
    else
        return $string[0];
}


?><commit_msg>implement optional param to capitalize for digit behavior<commit_after><?php
/**
 * Smarty plugin
 * @package Smarty
 * @subpackage plugins
 */


/**
 * Smarty capitalize modifier plugin
 *
 * Type:     modifier<br>
 * Name:     capitalize<br>
 * Purpose:  capitalize words in the string
 * @link http://smarty.php.net/manual/en/language.modifiers.php#LANGUAGE.MODIFIER.CAPITALIZE
 *      capitalize (Smarty online manual)
 * @param string
 * @return string
 */
function smarty_modifier_capitalize($string, $uc_digits = false)
{
    define('SMARTY_CAPITALIZE_UCDIGIT', $uc_digits);
    return preg_replace_callback('!\b\w+\b!', 'smarty_modifier_capitalize_ucfirst', $string);
}

function smarty_modifier_capitalize_ucfirst($string)
{
    if(!preg_match('!\d!',$string[0]) || SMARTY_CAPITALIZE_UCDIGIT)
        return ucfirst($string[0]);
    else
        return $string[0];
}


?>
{'fraction_non_alphanumeric': 0.138442521631644, 'fraction_numerical': 0.003708281829419036, 'mean_word_length': 4.172523961661342, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '1761133', 'n_tokens_mistral': 573, 'n_tokens_neox': 547, 'n_words': 102}