<commit_before>#include "stdafx.h"
#include "model.h"

wchar_t* ModelGetString(Model *this)
{
	return this->wcsBuffer;
}

int ModelGetStringCount(Model *this)
{
	return (int)wcslen(this->wcsBuffer);
}

Model* ModelClear(Model *this)
{
	this->wcsBuffer[0] = 0;
	return this;
}

Model* ModelPut(Model *this, wchar_t wchar)
{
	// Ի
	size_t len = wcslen(this->wcsBuffer);
	if(wchar == VK_BACK){
		if (len > 0) this->wcsBuffer[len - 1] = 0;
	}
	else if (wchar == VK_ESCAPE) {
		this->pAPI->Clear(this);
	}
	else if(wchar >= 0x30){
		if (len < MODEL_MAX_BUFFER - 1) {
			// δ
			this->wcsBuffer[len] = wchar;
			this->wcsBuffer[len + 1] = 0;
		}
		else {
			//  
			wcscpy_s(this->wcsBuffer, MODEL_MAX_BUFFER, this->wcsBuffer + 1);
			this->wcsBuffer[MODEL_MAX_BUFFER - 2] = wchar;
			this->wcsBuffer[MODEL_MAX_BUFFER - 1] = 0;
		}
	}
	return this;
}

Model* ModelInit(Model *this)
{
	static ModelFunctions s_fns =
	{
		.GetString = ModelGetString,
		.GetStringCount = ModelGetStringCount,
		.Clear = ModelClear,
		.Put = ModelPut
	};

	memset(this, 0, sizeof(Model));
	this->pAPI = &s_fns;
	return this;
}<commit_msg>fix char<commit_after>#include "stdafx.h"
#include "model.h"

wchar_t* ModelGetString(Model *this)
{
	return this->wcsBuffer;
}

int ModelGetStringCount(Model *this)
{
	return (int)wcslen(this->wcsBuffer);
}

Model* ModelClear(Model *this)
{
	this->wcsBuffer[0] = 0;
	return this;
}

Model* ModelPut(Model *this, wchar_t wchar)
{
	// Ի
	size_t len = wcslen(this->wcsBuffer);
	if(wchar == VK_BACK){
		if (len > 0) this->wcsBuffer[len - 1] = 0;
	}
	else if (wchar == VK_ESCAPE) {
		this->pAPI->Clear(this);
	}
	else if(wchar > 0x20){
		if (len < MODEL_MAX_BUFFER - 1) {
			// δ
			this->wcsBuffer[len] = wchar;
			this->wcsBuffer[len + 1] = 0;
		}
		else {
			//  
			wcscpy_s(this->wcsBuffer, MODEL_MAX_BUFFER, this->wcsBuffer + 1);
			this->wcsBuffer[MODEL_MAX_BUFFER - 2] = wchar;
			this->wcsBuffer[MODEL_MAX_BUFFER - 1] = 0;
		}
	}
	return this;
}

Model* ModelInit(Model *this)
{
	static ModelFunctions s_fns =
	{
		.GetString = ModelGetString,
		.GetStringCount = ModelGetStringCount,
		.Clear = ModelClear,
		.Put = ModelPut
	};

	memset(this, 0, sizeof(Model));
	this->pAPI = &s_fns;
	return this;
}
{'fraction_non_alphanumeric': 0.15295629820051415, 'fraction_numerical': 0.013710368466152529, 'mean_word_length': 2.984641638225256, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 35, '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': '5506803', 'n_tokens_mistral': 1056, 'n_tokens_neox': 986, 'n_words': 181}