<commit_before>module.exports = function(mongoose) {
    var schema = new mongoose.Schema({
        text:String,
        app:{type:mongoose.Schema.Types.ObjectId,ref:"apps"},
        user:{type:mongoose.Schema.Types.ObjectId,ref:"users"}
    },{
        timestamps:true
    })
    schema.methods.toResponseObject = function(){
        var obj = this.toObject();
        obj.id = this._id;
        obj._id = undefined;
        obj.__v = undefined;
        if(this.user.toResponseObject) obj.user=this.user.toResponseObject();
        if(this.app && this.app.toResponseObject){
            obj.app=this.app.toResponseObject();
            delete obj.app.appKey;
            delete obj.app.appSecret;
        }
        return obj;
    }
    return mongoose.model("posts",schema)
};
<commit_msg>support text_html<commit_after>module.exports = function(mongoose) {
    var schema = new mongoose.Schema({
        text:String,
        app:{type:mongoose.Schema.Types.ObjectId,ref:"apps"},
        user:{type:mongoose.Schema.Types.ObjectId,ref:"users"}
    },{
        timestamps:true
    })
    schema.methods.toResponseObject = function(){
        var obj = this.toObject();
        obj.id = this._id;
        obj._id = undefined;
        obj.__v = undefined;
        if(this.user.toResponseObject) obj.user=this.user.toResponseObject();
        if(this.app && this.app.toResponseObject){
            obj.app=this.app.toResponseObject();
            delete obj.app.appKey;
            delete obj.app.appSecret;
        }
        obj.text_html = obj.text;
        obj.text_html = obj.text_html.split('&').join("&amp;")
        obj.text_html = obj.text_html.split("<").join("&lt;")
        obj.text_html = obj.text_html.split(">").join("&gt;")
        // obj.text_html = obj.text_html.split('"').join("&quot;")
        obj.text_html = obj.text_html.replace(/(^| |　)@([A-Za-z0-9_]+)/g,'$1<a href="/u/$2">@$2</a>');
        obj.text_html = obj.text_html.replace(/(https?:\/\/[a-zA-Z0-9-\.]+(:[0-9]+)?(\/?[a-zA-Z0-9-\._~\!#$&'\(\)\*\+,\/:;=\?@\[\]]*))/g,'<a href="$1" rel="nofollow" target="_blank">$1</a>');
        return obj;
    }
    return mongoose.model("posts",schema)
};

{'fraction_non_alphanumeric': 0.18856885688568856, 'fraction_numerical': 0.0058505850585058505, 'mean_word_length': 2.2933333333333334, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, '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': '1415338', 'n_tokens_mistral': 756, 'n_tokens_neox': 747, 'n_words': 88}