<commit_before>// $Id$

#include "LanguageModelFactory.h"
#include "UserMessage.h"
#include "TypeDef.h"

// include appropriate header
#ifdef LM_SRI
#  include "LanguageModel_SRI.h"
#endif
#ifdef LM_IRST
#  include "LanguageModel_IRST.h"
#endif


namespace LanguageModelFactory
{

	LanguageModel* createLanguageModel(LMType lmType)
	{
	  LanguageModel *lm = NULL;
	  switch (lmType)
	  {
	  	case SRI:
				#ifdef LM_SRI
				  lm = new LanguageModel_SRI();
			  #endif
			  break;
			case IRST:
				#ifdef LM_IRST
	     		lm = new LanguageModel_IRST();
				#endif
				break;
	  }
	  if (lm == NULL)
	  {
	  	UserMessage::Add("Lnaguage model type unknown. Probably not compiled into library");
	  }
	  return lm;
	}

}
<commit_msg>fallback to another LM if what we have isn't compiled into lib<commit_after>// $Id$

#include "LanguageModelFactory.h"
#include "UserMessage.h"
#include "TypeDef.h"

// include appropriate header
#ifdef LM_SRI
#  include "LanguageModel_SRI.h"
#endif
#ifdef LM_IRST
#  include "LanguageModel_IRST.h"
#endif


namespace LanguageModelFactory
{

	LanguageModel* createLanguageModel(LMType lmType)
	{
	  LanguageModel *lm = NULL;
	  switch (lmType)
	  {
	  	case SRI:
				#ifdef LM_SRI
				  lm = new LanguageModel_SRI();
			  #endif
			  break;
			case IRST:
				#ifdef LM_IRST
	     		lm = new LanguageModel_IRST();
				#endif
				break;
	  }
	  if (lm == NULL)
	  {
	  	// fall back. pick what we have
	  	#ifdef LM_SRI
				lm = new LanguageModel_SRI();
			#else
				#ifdef LM_IRST
					lm = new LanguageModel_IRST();
				#else
			  	UserMessage::Add("Lnaguage model type unknown. Probably not compiled into library");
				#endif
			#endif			  
	  }
	  return lm;
	}

}

{'fraction_non_alphanumeric': 0.10253388332351208, 'fraction_numerical': 0.0, 'mean_word_length': 2.967289719626168, 'pattern_counts': {'":': 0, '<': 3, '<?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': '4919198', 'n_tokens_mistral': 714, 'n_tokens_neox': 587, 'n_words': 157}