Solve the issue of missing the last sentence with punctuation (#856)

Co-authored-by: Hao You <13182720519@sina.cn>
This commit is contained in:
yh646492956
2024-05-10 15:41:42 +08:00
committed by GitHub
parent 17cd3a5f01
commit 1eb60e8711

View File

@@ -8,6 +8,7 @@
#include <string>
#include <utility>
#include <vector>
#include <math.h>
#if __ANDROID_API__ >= 9
#include "android/asset_manager.h"
@@ -60,7 +61,7 @@ class OfflinePunctuationCtTransformerImpl : public OfflinePunctuationImpl {
int32_t segment_size = 20;
int32_t max_len = 200;
int32_t num_segments = (token_ids.size() + segment_size - 1) / segment_size;
int32_t num_segments = ceil(((float)token_ids.size() + segment_size - 1) / segment_size);
std::vector<int32_t> punctuations;
int32_t last = -1;