<commit_before>#include "SingleCollectionItemIdGenerator.h"

#include <boost/filesystem.hpp>
#include <glog/logging.h>

namespace sf1r
{

SingleCollectionItemIdGenerator::SingleCollectionItemIdGenerator(const std::string& dir)
    : idManager_((boost::filesystem::path(dir) / "item").string())
{
}

bool SingleCollectionItemIdGenerator::strIdToItemId(const std::string& strId, itemid_t& itemId)
{
    idManager_.getDocIdByDocName(strId, itemId);
    return true;
}

bool SingleCollectionItemIdGenerator::itemIdToStrId(itemid_t itemId, std::string& strId)
{
    if (idManager_.getDocNameByDocId(itemId, strId))
        return true;

    LOG(WARNING) << "in itemIdToStrId(), item id " << itemId << " does not exist";
    return false;<commit_msg>tiny fix<commit_after>#include "SingleCollectionItemIdGenerator.h"

#include <boost/filesystem.hpp>
#include <glog/logging.h>

namespace sf1r
{

SingleCollectionItemIdGenerator::SingleCollectionItemIdGenerator(const std::string& dir)
    : idManager_((boost::filesystem::path(dir) / "item").string())
{
}

bool SingleCollectionItemIdGenerator::strIdToItemId(const std::string& strId, itemid_t& itemId)
{
    try
    {
        idManager_.getDocIdByDocName(strId, itemId);
    }
    catch(const std::exception& e)
    {
        LOG(WARNING) << " strIdToItemId exception: " << e.what();
    }
    return true;
}

bool SingleCollectionItemIdGenerator::itemIdToStrId(itemid_t itemId, std::string& strId)
{
    if (idManager_.getDocNameByDocId(itemId, strId))
        return true;

    LOG(WARNING) << "in itemIdToStrId(), item id " << itemId << " does not exist";
    return false;
{'fraction_non_alphanumeric': 0.12962962962962962, 'fraction_numerical': 0.0012345679012345679, 'mean_word_length': 5.210727969348659, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 7, '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': '4442687', 'n_tokens_mistral': 537, 'n_tokens_neox': 533, 'n_words': 96}