Committed by
GitHub
Solve the issue of missing the last sentence with punctuation (#856)
Co-authored-by: Hao You <13182720519@sina.cn>
正在显示
1 个修改的文件
包含
2 行增加
和
1 行删除
| @@ -8,6 +8,7 @@ | @@ -8,6 +8,7 @@ | ||
| 8 | #include <string> | 8 | #include <string> |
| 9 | #include <utility> | 9 | #include <utility> |
| 10 | #include <vector> | 10 | #include <vector> |
| 11 | +#include <math.h> | ||
| 11 | 12 | ||
| 12 | #if __ANDROID_API__ >= 9 | 13 | #if __ANDROID_API__ >= 9 |
| 13 | #include "android/asset_manager.h" | 14 | #include "android/asset_manager.h" |
| @@ -60,7 +61,7 @@ class OfflinePunctuationCtTransformerImpl : public OfflinePunctuationImpl { | @@ -60,7 +61,7 @@ class OfflinePunctuationCtTransformerImpl : public OfflinePunctuationImpl { | ||
| 60 | 61 | ||
| 61 | int32_t segment_size = 20; | 62 | int32_t segment_size = 20; |
| 62 | int32_t max_len = 200; | 63 | int32_t max_len = 200; |
| 63 | - int32_t num_segments = (token_ids.size() + segment_size - 1) / segment_size; | 64 | + int32_t num_segments = ceil(((float)token_ids.size() + segment_size - 1) / segment_size); |
| 64 | 65 | ||
| 65 | std::vector<int32_t> punctuations; | 66 | std::vector<int32_t> punctuations; |
| 66 | int32_t last = -1; | 67 | int32_t last = -1; |
-
请 注册 或 登录 后发表评论