<commit_before>/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * Written (W) 2009 <NAME>
 * Copyright (C) 2009 Fraunhofer Institute FIRST and Max-Planck-Society
 */

#include <shogun/features/SNPFeatures.h>
#include <shogun/io/SGIO.h>
#include <shogun/features/Alphabet.h>
#include <shogun/lib/memory.h>

using namespace shogun;

CSNPFeatures::CSNPFeatures()
{
	SG_UNSTABLE("CSNPFeatures::CSNPFeatures()", "\n")

	strings = NULL;

	string_length = 0;
	num_strings = 0;
	w_dim = 0;

	normalization_const = 0.0;

	m_str_min = NULL;
	m_str_maj = NULL;
}

CSNPFeatures::CSNPFeatures(CStringFeatures<uint8_t>* str) : CDotFeatures(),
	m_str_min(NULL), m_str_maj(NULL)
{
	ASSERT(str)
	ASSERT(str->have_same_length())
	SG_REF(str);

	strings=str;
	string_length=str->get_max_vector_length();
	ASSERT((string_length & 1) == 0) // length divisible by 2
	w_dim=3*string_length/2;
	num_strings=str->get_num_vectors();
	CAlphabet* alpha=str->get_alphabet();
	ASSERT(alpha->get_alphabet()==SNP)
	SG_UNREF(alpha);

	obtain_base_strings();
	set_normalization_const();

}

CSNPFeatures::CSNPFeatures(const CSNPFeatures& orig)
	: CDotFeatures(orig), strings(orig.strings),
	normalization_const(orig.normalization_const),
	m_str_min(NULL), m_str_maj(NULL)
{
	SG_REF(strings);

	if (strings)
	{
		string_length=strings->get_max_vector_length();
		ASSERT((string_length & 1) == 0) // length divisible by 2
			w_dim=3*string_length;
		num_strings=strings->get_num_vectors();
	}
	else
	{
		string_length = 0;
		w_dim = 0;
		num_strings = 0;
		alphabet_size = 0;
	}

	obtain_base_strings();
}

CSNPFeatures::~CSNPFeatures()
{
	SG_UNREF(strings);
}

int32_t CSNPFeatures::get_dim_feature_space() const<commit_msg>fix copy & paste error<commit_after>/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * Written (W) 2009 <NAME>
 * Copyright (C) 2009 Fraunhofer Institute FIRST and Max-Planck-Society
 */

#include <shogun/features/SNPFeatures.h>
#include <shogun/io/SGIO.h>
#include <shogun/features/Alphabet.h>
#include <shogun/lib/memory.h>

using namespace shogun;

CSNPFeatures::CSNPFeatures()
{
	SG_UNSTABLE("CSNPFeatures::CSNPFeatures()", "\n")

	strings = NULL;

	string_length = 0;
	num_strings = 0;
	w_dim = 0;

	normalization_const = 0.0;

	m_str_min = NULL;
	m_str_maj = NULL;
}

CSNPFeatures::CSNPFeatures(CStringFeatures<uint8_t>* str) : CDotFeatures(),
	m_str_min(NULL), m_str_maj(NULL)
{
	ASSERT(str)
	ASSERT(str->have_same_length())
	SG_REF(str);

	strings=str;
	string_length=str->get_max_vector_length();
	ASSERT((string_length & 1) == 0) // length divisible by 2
	w_dim=3*string_length/2;
	num_strings=str->get_num_vectors();
	CAlphabet* alpha=str->get_alphabet();
	ASSERT(alpha->get_alphabet()==SNP)
	SG_UNREF(alpha);

	obtain_base_strings();
	set_normalization_const();

}

CSNPFeatures::CSNPFeatures(const CSNPFeatures& orig)
	: CDotFeatures(orig), strings(orig.strings),
	normalization_const(orig.normalization_const),
	m_str_min(NULL), m_str_maj(NULL)
{
	SG_REF(strings);

	if (strings)
	{
		string_length=strings->get_max_vector_length();
		ASSERT((string_length & 1) == 0) // length divisible by 2
			w_dim=3*string_length;
		num_strings=strings->get_num_vectors();
	}
	else
	{
		string_length = 0;
		w_dim = 0;
		num_strings = 0;
	}

	obtain_base_strings();
}

CSNPFeatures::~CSNPFeatures()
{
	SG_UNREF(strings);
}

int32_t CSNPFeatures::get_dim_feature_space() const
{'fraction_non_alphanumeric': 0.1312731114632858, 'fraction_numerical': 0.015583729529846805, 'mean_word_length': 5.529310344827586, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 29, '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': '6327000', 'n_tokens_mistral': 1516, 'n_tokens_neox': 1417, 'n_words': 286}