cppjieba_rb 0.4.2 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/.editorconfig +21 -0
  3. data/.github/workflows/linting.yml +30 -0
  4. data/.github/workflows/release.yml +42 -0
  5. data/.github/workflows/tests.yml +47 -0
  6. data/.gitignore +1 -0
  7. data/.rubocop.yml +45 -0
  8. data/.ruby-version +1 -0
  9. data/.yamllint +35 -0
  10. data/CHANGELOG.md +17 -0
  11. data/Gemfile +11 -0
  12. data/README.md +5 -5
  13. data/Rakefile +16 -7
  14. data/cppjieba_rb.gemspec +46 -33
  15. data/ext/cppjieba/.github/workflows/cmake.yml +52 -0
  16. data/ext/cppjieba/.github/workflows/stale-issues.yml +24 -0
  17. data/ext/cppjieba/.gitmodules +3 -0
  18. data/ext/cppjieba/{ChangeLog.md → CHANGELOG.md} +50 -1
  19. data/ext/cppjieba/CMakeLists.txt +11 -14
  20. data/ext/cppjieba/LICENSE +20 -0
  21. data/ext/cppjieba/README.md +9 -18
  22. data/ext/cppjieba/deps/limonp/.github/workflows/cmake.yml +43 -0
  23. data/ext/cppjieba/deps/limonp/.gitignore +9 -0
  24. data/ext/cppjieba/deps/limonp/CHANGELOG.md +160 -0
  25. data/ext/cppjieba/deps/limonp/CMakeLists.txt +61 -0
  26. data/ext/cppjieba/deps/limonp/LICENSE +20 -0
  27. data/ext/cppjieba/deps/limonp/README.md +38 -0
  28. data/ext/cppjieba/deps/limonp/{LocalVector.hpp → include/limonp/LocalVector.hpp} +3 -3
  29. data/ext/cppjieba/deps/limonp/{Logging.hpp → include/limonp/Logging.hpp} +17 -3
  30. data/ext/cppjieba/deps/limonp/{StringUtil.hpp → include/limonp/StringUtil.hpp} +31 -10
  31. data/ext/cppjieba/deps/limonp/test/CMakeLists.txt +8 -0
  32. data/ext/cppjieba/deps/limonp/test/demo.cpp +40 -0
  33. data/ext/cppjieba/deps/limonp/test/testdata/1.conf +5 -0
  34. data/ext/cppjieba/deps/limonp/test/testdata/StdExtension.data +3 -0
  35. data/ext/cppjieba/deps/limonp/test/testdata/dict.gbk +50 -0
  36. data/ext/cppjieba/deps/limonp/test/testdata/dict.utf8 +50 -0
  37. data/ext/cppjieba/deps/limonp/test/testdata/io_testfile +2 -0
  38. data/ext/cppjieba/deps/limonp/test/testdata/jieba.dict.0.1.utf8 +93 -0
  39. data/ext/cppjieba/deps/limonp/test/testdata/jieba.dict.0.utf8 +93 -0
  40. data/ext/cppjieba/deps/limonp/test/testdata/jieba.dict.1.utf8 +67 -0
  41. data/ext/cppjieba/deps/limonp/test/testdata/jieba.dict.2.utf8 +64 -0
  42. data/ext/cppjieba/deps/limonp/test/unittest/CMakeLists.txt +30 -0
  43. data/ext/cppjieba/deps/limonp/test/unittest/TArgvContext.cpp +16 -0
  44. data/ext/cppjieba/deps/limonp/test/unittest/TCastFloat.cpp +19 -0
  45. data/ext/cppjieba/deps/limonp/test/unittest/TClosure.cpp +85 -0
  46. data/ext/cppjieba/deps/limonp/test/unittest/TColorPrint.cpp +20 -0
  47. data/ext/cppjieba/deps/limonp/test/unittest/TConfig.cpp +17 -0
  48. data/ext/cppjieba/deps/limonp/test/unittest/TLocalVector.cpp +41 -0
  49. data/ext/cppjieba/deps/limonp/test/unittest/TLogging.cpp +12 -0
  50. data/ext/cppjieba/deps/limonp/test/unittest/TStdExtension.cpp +95 -0
  51. data/ext/cppjieba/deps/limonp/test/unittest/TStringUtil.cpp +183 -0
  52. data/ext/cppjieba/include/cppjieba/DictTrie.hpp +9 -0
  53. data/ext/cppjieba/include/cppjieba/Jieba.hpp +4 -0
  54. data/ext/cppjieba/include/cppjieba/Trie.hpp +27 -1
  55. data/ext/cppjieba/test/CMakeLists.txt +4 -3
  56. data/ext/cppjieba/test/unittest/CMakeLists.txt +16 -7
  57. data/ext/cppjieba_rb/extconf.rb +11 -6
  58. data/lib/cppjieba_rb/segment.rb +4 -1
  59. data/lib/cppjieba_rb/version.rb +3 -1
  60. data/lib/cppjieba_rb.rb +12 -5
  61. data/test/test_keyword.rb +8 -8
  62. data/test/test_segment.rb +14 -10
  63. data/test/test_stop_word_filter.rb +5 -3
  64. data/test/test_tagging.rb +5 -2
  65. metadata +63 -140
  66. data/.travis.yml +0 -30
  67. data/ext/cppjieba/.travis.yml +0 -21
  68. data/ext/cppjieba/README_EN.md +0 -115
  69. data/ext/cppjieba/appveyor.yml +0 -32
  70. data/ext/cppjieba/deps/CMakeLists.txt +0 -1
  71. data/ext/cppjieba/deps/gtest/CMakeLists.txt +0 -5
  72. data/ext/cppjieba/deps/gtest/include/gtest/gtest-death-test.h +0 -283
  73. data/ext/cppjieba/deps/gtest/include/gtest/gtest-message.h +0 -230
  74. data/ext/cppjieba/deps/gtest/include/gtest/gtest-param-test.h +0 -1421
  75. data/ext/cppjieba/deps/gtest/include/gtest/gtest-param-test.h.pump +0 -487
  76. data/ext/cppjieba/deps/gtest/include/gtest/gtest-printers.h +0 -796
  77. data/ext/cppjieba/deps/gtest/include/gtest/gtest-spi.h +0 -232
  78. data/ext/cppjieba/deps/gtest/include/gtest/gtest-test-part.h +0 -176
  79. data/ext/cppjieba/deps/gtest/include/gtest/gtest-typed-test.h +0 -259
  80. data/ext/cppjieba/deps/gtest/include/gtest/gtest.h +0 -2155
  81. data/ext/cppjieba/deps/gtest/include/gtest/gtest_pred_impl.h +0 -358
  82. data/ext/cppjieba/deps/gtest/include/gtest/gtest_prod.h +0 -58
  83. data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-death-test-internal.h +0 -308
  84. data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-filepath.h +0 -210
  85. data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-internal.h +0 -1226
  86. data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-linked_ptr.h +0 -233
  87. data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-param-util-generated.h +0 -4822
  88. data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-param-util-generated.h.pump +0 -301
  89. data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-param-util.h +0 -619
  90. data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-port.h +0 -1788
  91. data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-string.h +0 -350
  92. data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-tuple.h +0 -968
  93. data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-tuple.h.pump +0 -336
  94. data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-type-util.h +0 -3330
  95. data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-type-util.h.pump +0 -296
  96. data/ext/cppjieba/deps/gtest/src/.deps/gtest-all.Plo +0 -681
  97. data/ext/cppjieba/deps/gtest/src/.deps/gtest_main.Plo +0 -509
  98. data/ext/cppjieba/deps/gtest/src/.dirstamp +0 -0
  99. data/ext/cppjieba/deps/gtest/src/gtest-all.cc +0 -48
  100. data/ext/cppjieba/deps/gtest/src/gtest-death-test.cc +0 -1234
  101. data/ext/cppjieba/deps/gtest/src/gtest-filepath.cc +0 -380
  102. data/ext/cppjieba/deps/gtest/src/gtest-internal-inl.h +0 -1038
  103. data/ext/cppjieba/deps/gtest/src/gtest-port.cc +0 -746
  104. data/ext/cppjieba/deps/gtest/src/gtest-printers.cc +0 -356
  105. data/ext/cppjieba/deps/gtest/src/gtest-test-part.cc +0 -110
  106. data/ext/cppjieba/deps/gtest/src/gtest-typed-test.cc +0 -110
  107. data/ext/cppjieba/deps/gtest/src/gtest.cc +0 -4898
  108. data/ext/cppjieba/deps/limonp/BlockingQueue.hpp +0 -49
  109. data/ext/cppjieba/deps/limonp/BoundedBlockingQueue.hpp +0 -67
  110. data/ext/cppjieba/deps/limonp/BoundedQueue.hpp +0 -65
  111. data/ext/cppjieba/deps/limonp/FileLock.hpp +0 -74
  112. data/ext/cppjieba/deps/limonp/Md5.hpp +0 -411
  113. data/ext/cppjieba/deps/limonp/MutexLock.hpp +0 -51
  114. data/ext/cppjieba/deps/limonp/Thread.hpp +0 -44
  115. data/ext/cppjieba/deps/limonp/ThreadPool.hpp +0 -86
  116. data/ext/cppjieba/test/demo.cpp +0 -80
  117. /data/ext/cppjieba/deps/{gtest/src/.deps/.dirstamp → limonp/.gitmodules} +0 -0
  118. /data/ext/cppjieba/deps/limonp/{ArgvContext.hpp → include/limonp/ArgvContext.hpp} +0 -0
  119. /data/ext/cppjieba/deps/limonp/{Closure.hpp → include/limonp/Closure.hpp} +0 -0
  120. /data/ext/cppjieba/deps/limonp/{Colors.hpp → include/limonp/Colors.hpp} +0 -0
  121. /data/ext/cppjieba/deps/limonp/{Condition.hpp → include/limonp/Condition.hpp} +0 -0
  122. /data/ext/cppjieba/deps/limonp/{Config.hpp → include/limonp/Config.hpp} +0 -0
  123. /data/ext/cppjieba/deps/limonp/{ForcePublic.hpp → include/limonp/ForcePublic.hpp} +0 -0
  124. /data/ext/cppjieba/deps/limonp/{NonCopyable.hpp → include/limonp/NonCopyable.hpp} +0 -0
  125. /data/ext/cppjieba/deps/limonp/{StdExtension.hpp → include/limonp/StdExtension.hpp} +0 -0
  126. /data/ext/cppjieba/deps/{gtest/src/gtest_main.cc → limonp/test/unittest/gtest_main.cpp} +0 -0
@@ -1,296 +0,0 @@
1
- $$ -*- mode: c++; -*-
2
- $var n = 50 $$ Maximum length of type lists we want to support.
3
- // Copyright 2008 Google Inc.
4
- // All Rights Reserved.
5
- //
6
- // Redistribution and use in source and binary forms, with or without
7
- // modification, are permitted provided that the following conditions are
8
- // met:
9
- //
10
- // * Redistributions of source code must retain the above copyright
11
- // notice, this list of conditions and the following disclaimer.
12
- // * Redistributions in binary form must reproduce the above
13
- // copyright notice, this list of conditions and the following disclaimer
14
- // in the documentation and/or other materials provided with the
15
- // distribution.
16
- // * Neither the name of Google Inc. nor the names of its
17
- // contributors may be used to endorse or promote products derived from
18
- // this software without specific prior written permission.
19
- //
20
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
- // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
- // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23
- // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24
- // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25
- // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26
- // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27
- // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28
- // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29
- // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30
- // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
- //
32
- // Author: wan@google.com (Zhanyong Wan)
33
-
34
- // Type utilities needed for implementing typed and type-parameterized
35
- // tests. This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
36
- //
37
- // Currently we support at most $n types in a list, and at most $n
38
- // type-parameterized tests in one type-parameterized test case.
39
- // Please contact googletestframework@googlegroups.com if you need
40
- // more.
41
-
42
- #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
43
- #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
44
-
45
- #include "gtest/internal/gtest-port.h"
46
- #include "gtest/internal/gtest-string.h"
47
-
48
- // #ifdef __GNUC__ is too general here. It is possible to use gcc without using
49
- // libstdc++ (which is where cxxabi.h comes from).
50
- # ifdef __GLIBCXX__
51
- # include <cxxabi.h>
52
- # elif defined(__HP_aCC)
53
- # include <acxx_demangle.h>
54
- # endif // __GLIBCXX__
55
-
56
- namespace testing {
57
- namespace internal {
58
-
59
- // GetTypeName<T>() returns a human-readable name of type T.
60
- // NB: This function is also used in Google Mock, so don't move it inside of
61
- // the typed-test-only section below.
62
- template <typename T>
63
- String GetTypeName() {
64
- # if GTEST_HAS_RTTI
65
-
66
- const char* const name = typeid(T).name();
67
- # if defined(__GLIBCXX__) || defined(__HP_aCC)
68
- int status = 0;
69
- // gcc's implementation of typeid(T).name() mangles the type name,
70
- // so we have to demangle it.
71
- # ifdef __GLIBCXX__
72
- using abi::__cxa_demangle;
73
- # endif // __GLIBCXX__
74
- char* const readable_name = __cxa_demangle(name, 0, 0, &status);
75
- const String name_str(status == 0 ? readable_name : name);
76
- free(readable_name);
77
- return name_str;
78
- # else
79
- return name;
80
- # endif // __GLIBCXX__ || __HP_aCC
81
-
82
- # else
83
-
84
- return "<type>";
85
-
86
- # endif // GTEST_HAS_RTTI
87
- }
88
-
89
- #if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
90
-
91
- // AssertyTypeEq<T1, T2>::type is defined iff T1 and T2 are the same
92
- // type. This can be used as a compile-time assertion to ensure that
93
- // two types are equal.
94
-
95
- template <typename T1, typename T2>
96
- struct AssertTypeEq;
97
-
98
- template <typename T>
99
- struct AssertTypeEq<T, T> {
100
- typedef bool type;
101
- };
102
-
103
- // A unique type used as the default value for the arguments of class
104
- // template Types. This allows us to simulate variadic templates
105
- // (e.g. Types<int>, Type<int, double>, and etc), which C++ doesn't
106
- // support directly.
107
- struct None {};
108
-
109
- // The following family of struct and struct templates are used to
110
- // represent type lists. In particular, TypesN<T1, T2, ..., TN>
111
- // represents a type list with N types (T1, T2, ..., and TN) in it.
112
- // Except for Types0, every struct in the family has two member types:
113
- // Head for the first type in the list, and Tail for the rest of the
114
- // list.
115
-
116
- // The empty type list.
117
- struct Types0 {};
118
-
119
- // Type lists of length 1, 2, 3, and so on.
120
-
121
- template <typename T1>
122
- struct Types1 {
123
- typedef T1 Head;
124
- typedef Types0 Tail;
125
- };
126
-
127
- $range i 2..n
128
-
129
- $for i [[
130
- $range j 1..i
131
- $range k 2..i
132
- template <$for j, [[typename T$j]]>
133
- struct Types$i {
134
- typedef T1 Head;
135
- typedef Types$(i-1)<$for k, [[T$k]]> Tail;
136
- };
137
-
138
-
139
- ]]
140
-
141
- } // namespace internal
142
-
143
- // We don't want to require the users to write TypesN<...> directly,
144
- // as that would require them to count the length. Types<...> is much
145
- // easier to write, but generates horrible messages when there is a
146
- // compiler error, as gcc insists on printing out each template
147
- // argument, even if it has the default value (this means Types<int>
148
- // will appear as Types<int, None, None, ..., None> in the compiler
149
- // errors).
150
- //
151
- // Our solution is to combine the best part of the two approaches: a
152
- // user would write Types<T1, ..., TN>, and Google Test will translate
153
- // that to TypesN<T1, ..., TN> internally to make error messages
154
- // readable. The translation is done by the 'type' member of the
155
- // Types template.
156
-
157
- $range i 1..n
158
- template <$for i, [[typename T$i = internal::None]]>
159
- struct Types {
160
- typedef internal::Types$n<$for i, [[T$i]]> type;
161
- };
162
-
163
- template <>
164
- struct Types<$for i, [[internal::None]]> {
165
- typedef internal::Types0 type;
166
- };
167
-
168
- $range i 1..n-1
169
- $for i [[
170
- $range j 1..i
171
- $range k i+1..n
172
- template <$for j, [[typename T$j]]>
173
- struct Types<$for j, [[T$j]]$for k[[, internal::None]]> {
174
- typedef internal::Types$i<$for j, [[T$j]]> type;
175
- };
176
-
177
- ]]
178
-
179
- namespace internal {
180
-
181
- # define GTEST_TEMPLATE_ template <typename T> class
182
-
183
- // The template "selector" struct TemplateSel<Tmpl> is used to
184
- // represent Tmpl, which must be a class template with one type
185
- // parameter, as a type. TemplateSel<Tmpl>::Bind<T>::type is defined
186
- // as the type Tmpl<T>. This allows us to actually instantiate the
187
- // template "selected" by TemplateSel<Tmpl>.
188
- //
189
- // This trick is necessary for simulating typedef for class templates,
190
- // which C++ doesn't support directly.
191
- template <GTEST_TEMPLATE_ Tmpl>
192
- struct TemplateSel {
193
- template <typename T>
194
- struct Bind {
195
- typedef Tmpl<T> type;
196
- };
197
- };
198
-
199
- # define GTEST_BIND_(TmplSel, T) \
200
- TmplSel::template Bind<T>::type
201
-
202
- // A unique struct template used as the default value for the
203
- // arguments of class template Templates. This allows us to simulate
204
- // variadic templates (e.g. Templates<int>, Templates<int, double>,
205
- // and etc), which C++ doesn't support directly.
206
- template <typename T>
207
- struct NoneT {};
208
-
209
- // The following family of struct and struct templates are used to
210
- // represent template lists. In particular, TemplatesN<T1, T2, ...,
211
- // TN> represents a list of N templates (T1, T2, ..., and TN). Except
212
- // for Templates0, every struct in the family has two member types:
213
- // Head for the selector of the first template in the list, and Tail
214
- // for the rest of the list.
215
-
216
- // The empty template list.
217
- struct Templates0 {};
218
-
219
- // Template lists of length 1, 2, 3, and so on.
220
-
221
- template <GTEST_TEMPLATE_ T1>
222
- struct Templates1 {
223
- typedef TemplateSel<T1> Head;
224
- typedef Templates0 Tail;
225
- };
226
-
227
- $range i 2..n
228
-
229
- $for i [[
230
- $range j 1..i
231
- $range k 2..i
232
- template <$for j, [[GTEST_TEMPLATE_ T$j]]>
233
- struct Templates$i {
234
- typedef TemplateSel<T1> Head;
235
- typedef Templates$(i-1)<$for k, [[T$k]]> Tail;
236
- };
237
-
238
-
239
- ]]
240
-
241
- // We don't want to require the users to write TemplatesN<...> directly,
242
- // as that would require them to count the length. Templates<...> is much
243
- // easier to write, but generates horrible messages when there is a
244
- // compiler error, as gcc insists on printing out each template
245
- // argument, even if it has the default value (this means Templates<list>
246
- // will appear as Templates<list, NoneT, NoneT, ..., NoneT> in the compiler
247
- // errors).
248
- //
249
- // Our solution is to combine the best part of the two approaches: a
250
- // user would write Templates<T1, ..., TN>, and Google Test will translate
251
- // that to TemplatesN<T1, ..., TN> internally to make error messages
252
- // readable. The translation is done by the 'type' member of the
253
- // Templates template.
254
-
255
- $range i 1..n
256
- template <$for i, [[GTEST_TEMPLATE_ T$i = NoneT]]>
257
- struct Templates {
258
- typedef Templates$n<$for i, [[T$i]]> type;
259
- };
260
-
261
- template <>
262
- struct Templates<$for i, [[NoneT]]> {
263
- typedef Templates0 type;
264
- };
265
-
266
- $range i 1..n-1
267
- $for i [[
268
- $range j 1..i
269
- $range k i+1..n
270
- template <$for j, [[GTEST_TEMPLATE_ T$j]]>
271
- struct Templates<$for j, [[T$j]]$for k[[, NoneT]]> {
272
- typedef Templates$i<$for j, [[T$j]]> type;
273
- };
274
-
275
- ]]
276
-
277
- // The TypeList template makes it possible to use either a single type
278
- // or a Types<...> list in TYPED_TEST_CASE() and
279
- // INSTANTIATE_TYPED_TEST_CASE_P().
280
-
281
- template <typename T>
282
- struct TypeList { typedef Types1<T> type; };
283
-
284
-
285
- $range i 1..n
286
- template <$for i, [[typename T$i]]>
287
- struct TypeList<Types<$for i, [[T$i]]> > {
288
- typedef typename Types<$for i, [[T$i]]>::type type;
289
- };
290
-
291
- #endif // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
292
-
293
- } // namespace internal
294
- } // namespace testing
295
-
296
- #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_