<commit_before>
var ReactAlphabetAvatar = React.createClass({

    propTypes: {
        avatar: React.PropTypes.string,
        width: React.PropTypes.number,
        height: React.PropTypes.number,
        border_radius: React.PropTypes.number,
        colorset: React.PropTypes.array,
        bold: React.PropTypes.boolean,
        text: React.PropTypes.string.isRequired
    },

    getDefaultProps: function(){
        return {
            width: 50,
            height: 50,
            border_radius: 0,
            text: 'A',
            colorset: ['#ed7872', '#5e97f6', '#ba68c8', '#66cccc', '#fbc02d', '#90a4ae', '#8d6e63', '#6492ce'],
            bold: false
        };
    },

    getInitialState: function() {
        return {
            error : false
        }
    },

    getColorset: function(alphabet) {
        return this.props.colorset[this.getStringHashCode(alphabet) % this.props.colorset.length];
    },

    getStringHashCode: function(string) {
        var hash = 0, i, chr, len;
        if (string.length == 0) return hash;
        for (i = 0, len = string.length; i < len; i++) {
            chr   = string.charCodeAt(i);
            hash  = ((hash << 5) - hash) + chr;
            hash |= 0; // Convert to 32bit integer
        }
        return hash;
    },

    imageError: function() {
        this.setState({error: true});
    },

    render: function(){

        var avatar,
            alphabet = this.props.text.substring(0, 1).toUpperCase(),
            fontSize = Math.round((this.props.height + this.props.width) / 4);

        var divStyle = {
                overflow: 'hidden',
                margin: 0,
                padding: 0,
                color: 'white',
                height: this.props.height,
                width: this.props.width,
                lineHeight: this.props.height + 'px',
                textAlign: 'center',
                background: this.getColorset(alphabet),
                borderRadius: this.props.border_radius,
                fontSize: fontSize
            },<commit_msg>coding style change and change hash string (one char to full string)<commit_after>
var ReactAlphabetAvatar = React.createClass({

    propTypes: {
        // data properties
        avatar: React.PropTypes.string,
        text: React.PropTypes.string.isRequired,

        // style option properties
        width: React.PropTypes.number,
        height: React.PropTypes.number,
        border_radius: React.PropTypes.number,
        colorset: React.PropTypes.array,
        bold: React.PropTypes.boolean
    },

    getDefaultProps: function() {
        return {
            text: 'A',
            width: 50,
            height: 50,
            border_radius: 0,
            colorset: ['#ed7872', '#5e97f6', '#ba68c8', '#66cccc', '#fbc02d', '#90a4ae', '#8d6e63', '#6492ce'],
            bold: false
        };
    },

    getInitialState: function() {
        return {
            error : false
        }
    },

    getColorset: function(text) {
        return this.props.colorset[this.getStringHashCode(text) % this.props.colorset.length];
    },

    getStringHashCode: function(string) {
        var hash = 0, i, chr, len;
        if (string.length == 0) return hash;
        for (i = 0, len = string.length; i < len; i++) {
            chr   = string.charCodeAt(i);
            hash  = ((hash << 5) - hash) + chr;
            hash |= 0; // Convert to 32bit integer
        }
        return hash;
    },

    imageError: function() {
        this.setState({error: true});
    },

    render: function() {

        var avatar,
            alphabet = this.props.text.substring(0, 1).toUpperCase(),
            fontSize = Math.round((this.props.height + this.props.width) / 4);

        var divStyle = {
                overflow: 'hidden',
                margin: 0,
                padding: 0,
                color: 'white',
                height: this.props.height,
                width: this.props.width,
                lineHeight: this.props.height + 'px',
                textAlign: 'center',
                background: this.getColorset(this.props.text),
                borderRadius: this.props.border_radius,
                fontSize: fontSize
            },
{'fraction_non_alphanumeric': 0.12455600284158182, 'fraction_numerical': 0.020364669666114138, 'mean_word_length': 1.6666666666666667, 'pattern_counts': {'":': 0, '<': 9, '<?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': '790927', 'n_tokens_mistral': 1288, 'n_tokens_neox': 1194, 'n_words': 270}