ukui-search/libchinese-segmentation/chinese-segmentation.h

33 lines
815 B
C
Raw Normal View History

2020-12-30 14:42:04 +08:00
#ifndef CHINESESEGMENTATION_H
#define CHINESESEGMENTATION_H
#include "libchinese-segmentation_global.h"
#include "cppjieba/Jieba.hpp"
//#include "Logging.hpp"
//#include "LocalVector.hpp"
//#include "cppjieba/QuerySegment.hpp"
#include "cppjieba/KeywordExtractor.hpp"
#include <QVector>
#include <QString>
#include <QDebug>
struct SKeyWord{
std::string word;
QVector<size_t> offsets;
double weight;
};
2020-12-30 14:42:04 +08:00
class CHINESESEGMENTATION_EXPORT ChineseSegmentation
{
public:
2021-01-04 14:35:04 +08:00
static ChineseSegmentation *getInstance();
QVector<SKeyWord> callSegement(QString *str);
void convert(std::vector<cppjieba::KeywordExtractor::Word>& keywordres,QVector<SKeyWord>& kw);
private:
2021-01-04 14:35:04 +08:00
cppjieba::Jieba *m_jieba;
explicit ChineseSegmentation();
~ChineseSegmentation();
2020-12-30 14:42:04 +08:00
};
#endif // CHINESESEGMENTATION_H