<commit_before>#include "Label.h"
#include "Config.h"
#include "Hash.h"

#include <boost/format.hpp>
#include <boost/locale.hpp>
#include <spine/Exception.h>
#include <cmath>
#include <iomanip>
#include <stdexcept>

namespace SmartMet
{
namespace Plugin
{
namespace Dali
{
// ----------------------------------------------------------------------
/*!
 * \brief Set the locale
 *
 * Generating a locale is slow, hence locale and formatter are data members
 */
// ----------------------------------------------------------------------

void Label::setLocale(const std::string& theLocale)
{
  try
  {
    if (!theLocale.empty())
    {
      boost::locale::generator gen;
      formatter->imbue(gen(theLocale.c_str()));
    }
  }
  catch (...)
  {
    throw Spine::Exception::Trace(BCP, "Operation failed!");
  }
}

// ----------------------------------------------------------------------
/*!
 * \brief Format the value
 */
// ----------------------------------------------------------------------

std::string Label::print(double theValue) const
{
  try
  {
    // TODO: querydata should return NaN for kFloatMissing<commit_msg>Removed redundant call to c_str()<commit_after>#include "Label.h"
#include "Config.h"
#include "Hash.h"

#include <boost/format.hpp>
#include <boost/locale.hpp>
#include <spine/Exception.h>
#include <cmath>
#include <iomanip>
#include <stdexcept>

namespace SmartMet
{
namespace Plugin
{
namespace Dali
{
// ----------------------------------------------------------------------
/*!
 * \brief Set the locale
 *
 * Generating a locale is slow, hence locale and formatter are data members
 */
// ----------------------------------------------------------------------

void Label::setLocale(const std::string& theLocale)
{
  try
  {
    if (!theLocale.empty())
    {
      boost::locale::generator gen;
      formatter->imbue(gen(theLocale));
    }
  }
  catch (...)
  {
    throw Spine::Exception::Trace(BCP, "Operation failed!");
  }
}

// ----------------------------------------------------------------------
/*!
 * \brief Format the value
 */
// ----------------------------------------------------------------------

std::string Label::print(double theValue) const
{
  try
  {
    // TODO: querydata should return NaN for kFloatMissing
{'fraction_non_alphanumeric': 0.36174911660777387, 'fraction_numerical': 0.0, 'mean_word_length': 1.394291754756871, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 17, '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': '3570577', 'n_tokens_mistral': 595, 'n_tokens_neox': 586, 'n_words': 145}