mirror of
https://github.com/yanyiwu/cppjieba.git
synced 2025-07-18 00:00:12 +08:00
add DEFINE MIN MACRO
This commit is contained in:
parent
14aa9168d3
commit
80f9d2ea4c
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "MPSegment.hpp"
|
#include "MPSegment.hpp"
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
|
||||||
|
|
||||||
namespace CppJieba
|
namespace CppJieba
|
||||||
{
|
{
|
||||||
@ -109,7 +110,7 @@ namespace CppJieba
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
keywords.resize(min(topN, wordmap.size()));
|
keywords.resize(MIN(topN, wordmap.size()));
|
||||||
partial_sort_copy(wordmap.begin(), wordmap.end(), keywords.begin(), keywords.end(), _cmp);
|
partial_sort_copy(wordmap.begin(), wordmap.end(), keywords.begin(), keywords.end(), _cmp);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -16,9 +16,9 @@ TEST(SegmentBaseTest, Test1)
|
|||||||
uint offset = 0;
|
uint offset = 0;
|
||||||
while(offset < size)
|
while(offset < size)
|
||||||
{
|
{
|
||||||
uint len;
|
uint len = 0;
|
||||||
const char* t = str + offset;
|
const char* t = str + offset;
|
||||||
int ret = SegmentBase::filterAscii(t, size - offset, len);
|
SegmentBase::filterAscii(t, size - offset, len);
|
||||||
s.assign(t, len);
|
s.assign(t, len);
|
||||||
res.push_back(s);
|
res.push_back(s);
|
||||||
//cout<<s<<","<<ret<<","<<len<<endl;
|
//cout<<s<<","<<ret<<","<<len<<endl;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user