add patch2 to sentencepiece

This commit is contained in:
xiefangqi 2021-11-02 15:50:59 +08:00
parent fe52606635
commit 4a430e108e
2 changed files with 26 additions and 1 deletions

View File

@ -0,0 +1,22 @@
diff --git a/third_party/esaxx/sais.hxx b/third_party/esaxx/sais.hxx
index f1702f8..b9071c8 100644
--- a/third_party/esaxx/sais.hxx
+++ b/third_party/esaxx/sais.hxx
@@ -179,7 +179,7 @@ typedef typename std::iterator_traits<string_type>::value_type char_type;
sort all the S-substrings */
if(fs < (maxthreads * k)) {
index_type *C, *B;
- if((C = new index_type[maxthreads * k]) == 0) { return -2; }
+ C = new index_type[maxthreads * k];
B = (1 < maxthreads) ? C + k : C;
getCounts(T, C, n, k); getBuckets(C, B, k, true); /* find ends of buckets */
#ifdef _OPENMP
@@ -271,7 +271,7 @@ typedef typename std::iterator_traits<string_type>::value_type char_type;
/* stage 3: induce the result for the original problem */
if(fs < (maxthreads * k)) {
index_type *B, *C;
- if((C = new index_type[maxthreads * k]) == 0) { return -2; }
+ C = new index_type[maxthreads * k];
B = (1 < maxthreads) ? C + k : C;
/* put all left-most S characters into their buckets */
getCounts(T, C, n, k); getBuckets(C, B, k, true); /* find ends of buckets */

View File

@ -1,11 +1,12 @@
Name: sentencepiece
Version: 0.1.92
Release: 3
Release: 4
Summary: An unsupervised text tokenizer and detokenizer
License: Apache-2.0
URL: https://github.com/google/sentencepiece
Source0: https://github.com/google/sentencepiece/archive/v%{version}.tar.gz
Patch0: Removed-codes-where-Zero-Width-Joiner-replaced-with-.patch
Patch1: fix_of_an_unattainable_condition.patch
BuildRequires: gcc-c++ gcc autoconf pkgconfig protobuf-compiler protobuf
BuildRequires: cmake >= 3.14.0
Requires: protobuf protobuf-compiler
@ -48,6 +49,8 @@ make install
%{_includedir}/sentencepiece_*.h
%changelog
* Tue Nov 2 2021 xiefangqi <xiefangqi2@huawei.com> - 0.1.92-4
- fix of an unattainable condition
* Tue Nov 2 2021 xiefangqi <xiefangqi2@huawei.com> - 0.1.92-3
- Prevent Zero Width Joiner replaced with whitespace
* Wed Sep 29 2021 xiefangqi <xiefangqi2@huawei.com> - 0.1.92-2