chaine 3.13.1__cp312-cp312-musllinux_1_2_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of chaine might be problematic. Click here for more details.

Files changed (70) hide show
  1. chaine/__init__.py +2 -0
  2. chaine/_core/crf.cpp +19854 -0
  3. chaine/_core/crf.cpython-312-x86_64-linux-musl.so +0 -0
  4. chaine/_core/crf.pyx +271 -0
  5. chaine/_core/crfsuite/COPYING +27 -0
  6. chaine/_core/crfsuite/README +183 -0
  7. chaine/_core/crfsuite/include/crfsuite.h +1077 -0
  8. chaine/_core/crfsuite/include/crfsuite.hpp +649 -0
  9. chaine/_core/crfsuite/include/crfsuite_api.hpp +406 -0
  10. chaine/_core/crfsuite/include/os.h +65 -0
  11. chaine/_core/crfsuite/lib/cqdb/COPYING +28 -0
  12. chaine/_core/crfsuite/lib/cqdb/include/cqdb.h +518 -0
  13. chaine/_core/crfsuite/lib/cqdb/src/cqdb.c +639 -0
  14. chaine/_core/crfsuite/lib/cqdb/src/lookup3.c +1271 -0
  15. chaine/_core/crfsuite/lib/cqdb/src/main.c +184 -0
  16. chaine/_core/crfsuite/lib/crf/src/crf1d.h +354 -0
  17. chaine/_core/crfsuite/lib/crf/src/crf1d_context.c +788 -0
  18. chaine/_core/crfsuite/lib/crf/src/crf1d_encode.c +1020 -0
  19. chaine/_core/crfsuite/lib/crf/src/crf1d_feature.c +382 -0
  20. chaine/_core/crfsuite/lib/crf/src/crf1d_model.c +1085 -0
  21. chaine/_core/crfsuite/lib/crf/src/crf1d_tag.c +582 -0
  22. chaine/_core/crfsuite/lib/crf/src/crfsuite.c +500 -0
  23. chaine/_core/crfsuite/lib/crf/src/crfsuite_internal.h +233 -0
  24. chaine/_core/crfsuite/lib/crf/src/crfsuite_train.c +302 -0
  25. chaine/_core/crfsuite/lib/crf/src/dataset.c +115 -0
  26. chaine/_core/crfsuite/lib/crf/src/dictionary.c +127 -0
  27. chaine/_core/crfsuite/lib/crf/src/holdout.c +83 -0
  28. chaine/_core/crfsuite/lib/crf/src/json.c +1497 -0
  29. chaine/_core/crfsuite/lib/crf/src/json.h +120 -0
  30. chaine/_core/crfsuite/lib/crf/src/logging.c +85 -0
  31. chaine/_core/crfsuite/lib/crf/src/logging.h +49 -0
  32. chaine/_core/crfsuite/lib/crf/src/params.c +370 -0
  33. chaine/_core/crfsuite/lib/crf/src/params.h +84 -0
  34. chaine/_core/crfsuite/lib/crf/src/quark.c +180 -0
  35. chaine/_core/crfsuite/lib/crf/src/quark.h +46 -0
  36. chaine/_core/crfsuite/lib/crf/src/rumavl.c +1178 -0
  37. chaine/_core/crfsuite/lib/crf/src/rumavl.h +144 -0
  38. chaine/_core/crfsuite/lib/crf/src/train_arow.c +409 -0
  39. chaine/_core/crfsuite/lib/crf/src/train_averaged_perceptron.c +237 -0
  40. chaine/_core/crfsuite/lib/crf/src/train_l2sgd.c +491 -0
  41. chaine/_core/crfsuite/lib/crf/src/train_lbfgs.c +323 -0
  42. chaine/_core/crfsuite/lib/crf/src/train_passive_aggressive.c +442 -0
  43. chaine/_core/crfsuite/lib/crf/src/vecmath.h +360 -0
  44. chaine/_core/crfsuite/swig/crfsuite.cpp +1 -0
  45. chaine/_core/crfsuite_api.pxd +67 -0
  46. chaine/_core/liblbfgs/COPYING +22 -0
  47. chaine/_core/liblbfgs/README +71 -0
  48. chaine/_core/liblbfgs/include/lbfgs.h +745 -0
  49. chaine/_core/liblbfgs/lib/arithmetic_ansi.h +142 -0
  50. chaine/_core/liblbfgs/lib/arithmetic_sse_double.h +303 -0
  51. chaine/_core/liblbfgs/lib/arithmetic_sse_float.h +312 -0
  52. chaine/_core/liblbfgs/lib/lbfgs.c +1531 -0
  53. chaine/_core/tagger_wrapper.hpp +58 -0
  54. chaine/_core/trainer_wrapper.cpp +32 -0
  55. chaine/_core/trainer_wrapper.hpp +26 -0
  56. chaine/crf.py +505 -0
  57. chaine/logging.py +214 -0
  58. chaine/optimization/__init__.py +10 -0
  59. chaine/optimization/metrics.py +129 -0
  60. chaine/optimization/spaces.py +394 -0
  61. chaine/optimization/trial.py +103 -0
  62. chaine/optimization/utils.py +119 -0
  63. chaine/training.py +184 -0
  64. chaine/typing.py +18 -0
  65. chaine/validation.py +43 -0
  66. chaine-3.13.1.dist-info/METADATA +348 -0
  67. chaine-3.13.1.dist-info/RECORD +70 -0
  68. chaine-3.13.1.dist-info/WHEEL +4 -0
  69. chaine.libs/libgcc_s-a0b57c20.so.1 +0 -0
  70. chaine.libs/libstdc++-0d31ccbe.so.6.0.32 +0 -0
chaine/_core/crf.pyx ADDED
@@ -0,0 +1,271 @@
1
+ # cython: embedsignature=True
2
+ # cython: c_string_type=str
3
+ # cython: c_string_encoding=utf-8
4
+ # cython: profile=False
5
+ # cython: language_level=2
6
+ # distutils: language=c++
7
+
8
+ cimport crfsuite_api
9
+ from libcpp.string cimport string
10
+ import os
11
+
12
+ from chaine.logging import Logger
13
+ from chaine.typing import Filepath, Labels, Sequence
14
+
15
+ LOGGER = Logger(__name__)
16
+
17
+
18
+ cdef class Trainer:
19
+ cdef crfsuite_api.Trainer _trainer
20
+
21
+ param2kwarg = {
22
+ "feature.minfreq": "min_freq",
23
+ "feature.possible_states": "all_possible_states",
24
+ "feature.possible_transitions": "all_possible_transitions",
25
+ "calibration.eta": "calibration_eta",
26
+ "calibration.rate": "calibration_rate",
27
+ "calibration.samples": "calibration_samples",
28
+ "calibration.candidates": "calibration_candidates",
29
+ "calibration.max_trials": "calibration_max_trials",
30
+ "type": "pa_type",
31
+ }
32
+ kwarg2param = {
33
+ "min_freq": "feature.minfreq",
34
+ "all_possible_states": "feature.possible_states",
35
+ "all_possible_transitions": "feature.possible_transitions",
36
+ "calibration_eta": "calibration.eta",
37
+ "calibration_rate": "calibration.rate",
38
+ "calibration_samples": "calibration.samples",
39
+ "calibration_candidates": "calibration.candidates",
40
+ "calibration_max_trials": "calibration.max_trials",
41
+ "pa_type": "type",
42
+ }
43
+ _algorithm_aliases = {
44
+ "lbfgs": "lbfgs",
45
+ "limited-memory-bfgs": "lbfgs",
46
+ "l2sgd": "l2sgd",
47
+ "sgd": "l2sgd",
48
+ "stochastic-gradient-descent": "l2sgd",
49
+ "ap": "averaged-perceptron",
50
+ "averaged-perceptron": "averaged-perceptron",
51
+ "pa": "passive-aggressive",
52
+ "passive-aggressive": "passive-aggressive",
53
+ "arow": "arow"
54
+ }
55
+ _parameter_types = {
56
+ "feature.minfreq": float,
57
+ "feature.possible_states": lambda value: bool(int(value)),
58
+ "feature.possible_transitions": lambda value: bool(int(value)),
59
+ "c1": float,
60
+ "c2": float,
61
+ "max_iterations": int,
62
+ "num_memories": int,
63
+ "epsilon": float,
64
+ "period": int,
65
+ "delta": float,
66
+ "linesearch": str,
67
+ "max_linesearch": int,
68
+ "calibration.eta": float,
69
+ "calibration.rate": float,
70
+ "calibration.samples": float,
71
+ "calibration.candidates": int,
72
+ "calibration.max_trials": int,
73
+ "type": int,
74
+ "c": float,
75
+ "error_sensitive": lambda value: bool(int(value)),
76
+ "averaging": lambda value: bool(int(value)),
77
+ "variance": float,
78
+ "gamma": float,
79
+ }
80
+
81
+ def __init__(self, algorithm: str, **kwargs):
82
+ self.select_algorithm(algorithm)
83
+ self.set_params(self.translate_params(kwargs))
84
+
85
+ def __cinit__(self):
86
+ self._trainer.set_handler(self, <crfsuite_api.messagefunc>self._on_message)
87
+ self._trainer.select("l2sgd", "crf1d")
88
+ self._trainer._init_trainer()
89
+
90
+ @property
91
+ def params(self):
92
+ return self._trainer.params()
93
+
94
+ def train(self, model_filepath: Filepath):
95
+ self._trainer.train(str(model_filepath), -1)
96
+
97
+ def _log(self, message: str):
98
+ LOGGER.info(message)
99
+
100
+ cdef _on_message(self, string message):
101
+ self._log(message)
102
+
103
+ def append(self, sequence: Sequence, labels: Labels, int group=0):
104
+ # no generators allowed
105
+ if not isinstance(sequence, list):
106
+ sequence = [item for item in sequence]
107
+ if not isinstance(labels, list):
108
+ # labels must be strings
109
+ labels = [str(label) for label in labels]
110
+
111
+ self._trainer.append(to_seq(sequence), labels, group)
112
+
113
+ def translate_params(self, kwargs: dict[str, str | int | float | bool]):
114
+ return {
115
+ self.kwarg2param.get(kwarg, kwarg): value
116
+ for kwarg, value in kwargs.items()
117
+ }
118
+
119
+ def select_algorithm(self, algorithm: str):
120
+ try:
121
+ algorithm = self._algorithm_aliases[algorithm.lower()]
122
+ except:
123
+ raise ValueError(f"{algorithm} is no available algorithm")
124
+ if not self._trainer.select(algorithm, "crf1d"):
125
+ raise ValueError(f"{algorithm} is no available algorithm")
126
+
127
+ def set_params(self, params: dict[str, str | int | float | bool]):
128
+ for param, value in params.items():
129
+ self.set_param(param, value)
130
+
131
+ def set_param(self, param: str, value: str | int | float | bool):
132
+ if isinstance(value, bool):
133
+ value = int(value)
134
+ self._trainer.set(param, str(value))
135
+
136
+ def get_param(self, param: str):
137
+ return self.cast_parameter(param, self._trainer.get(param))
138
+
139
+ def cast_parameter(self, param: str, value: str | int | float | bool):
140
+ if param in self._parameter_types:
141
+ return self._parameter_types[param](value)
142
+ return value
143
+
144
+
145
+ cdef class Model:
146
+ cdef crfsuite_api.Tagger _tagger
147
+
148
+ def __init__(self, model_filepath: Filepath):
149
+ self.load(model_filepath)
150
+
151
+ @property
152
+ def labels(self):
153
+ return self._tagger.labels()
154
+
155
+ def predict_single(self, sequence: Sequence) -> list[str]:
156
+ self.set_sequence(sequence)
157
+ return self._tagger.viterbi()
158
+
159
+ def predict_proba_single(self, sequence: Sequence) -> list[dict[str, float]]:
160
+ self.set_sequence(sequence)
161
+ return [
162
+ {label: self.marginal(label, index) for label in self.labels}
163
+ for index in range(len(sequence))
164
+ ]
165
+
166
+ def load(self, filepath: Filepath):
167
+ filepath = str(filepath)
168
+ self.check_model(filepath)
169
+ if not self._tagger.open(filepath):
170
+ raise ValueError(f"Cannot load model file {filepath}")
171
+
172
+ def marginal(self, label: str, index: int):
173
+ return self._tagger.marginal(label, index)
174
+
175
+ cpdef set_sequence(self, sequence) except +:
176
+ self._tagger.set(to_seq(sequence))
177
+
178
+ @staticmethod
179
+ def check_model(filepath: str):
180
+ with open(filepath, "rb") as model:
181
+ magic = model.read(4)
182
+ if magic != b"lCRF":
183
+ raise ValueError(f"Invalid model file {filepath}")
184
+ model.seek(0, os.SEEK_END)
185
+ if model.tell() <= 48:
186
+ raise ValueError(f"Model file {filepath} does not have a complete header")
187
+
188
+ def dump_transitions(self, filepath: Filepath):
189
+ self._tagger.dump_transitions(os.open(str(filepath), os.O_WRONLY | os.O_CREAT))
190
+
191
+ def dump_states(self, filepath: Filepath):
192
+ self._tagger.dump_states(os.open(str(filepath), os.O_WRONLY | os.O_CREAT))
193
+
194
+ cdef crfsuite_api.Item to_item(sequence) except+:
195
+ cdef crfsuite_api.Item c_item
196
+ cdef double c_value
197
+ cdef string c_token
198
+ cdef string separator
199
+ cdef bint is_dict, is_nested_value
200
+
201
+ separator = b":"
202
+ is_dict = isinstance(sequence, dict)
203
+ c_item = crfsuite_api.Item()
204
+ c_item.reserve(len(sequence))
205
+
206
+ for token in sequence:
207
+ if isinstance(token, unicode):
208
+ c_token = (<unicode>token).encode("utf8")
209
+ else:
210
+ c_token = token
211
+ if not is_dict:
212
+ c_value = 1.0
213
+ c_item.push_back(crfsuite_api.Attribute(c_token, c_value))
214
+ else:
215
+ value = (<dict>sequence)[token]
216
+ if isinstance(value, (dict, list, set)):
217
+ for attr in to_item(value):
218
+ c_item.push_back(
219
+ crfsuite_api.Attribute(c_token + separator + attr.attr, attr.value)
220
+ )
221
+ else:
222
+ if isinstance(value, unicode):
223
+ c_token += separator
224
+ c_token += <string>(<unicode>value).encode("utf8")
225
+ c_value = 1.0
226
+ elif isinstance(value, bytes):
227
+ c_token += separator
228
+ c_token += <string>value
229
+ c_value = 1.0
230
+ else:
231
+ c_value = value
232
+ c_item.push_back(crfsuite_api.Attribute(c_token, c_value))
233
+ return c_item
234
+
235
+
236
+ cdef crfsuite_api.ItemSequence to_seq(sequence) except+:
237
+ cdef crfsuite_api.ItemSequence c_sequence
238
+
239
+ if isinstance(sequence, ItemSequence):
240
+ c_sequence = (<ItemSequence>sequence).c_sequence
241
+ else:
242
+ for s in sequence:
243
+ c_sequence.push_back(to_item(s))
244
+ return c_sequence
245
+
246
+
247
+ cdef class ItemSequence:
248
+ cdef crfsuite_api.ItemSequence c_sequence
249
+
250
+ def __init__(self, sequence):
251
+ self.c_sequence = to_seq(sequence)
252
+
253
+ def items(self):
254
+ cdef crfsuite_api.Item c_item
255
+ cdef crfsuite_api.Attribute c_attr
256
+ cdef bytes token
257
+
258
+ sequence = []
259
+ for c_item in self.c_sequence:
260
+ x = {}
261
+ for c_attr in c_item:
262
+ token = <bytes>c_attr.attr.c_str()
263
+ x[token.decode("utf8")] = c_attr.value
264
+ sequence.append(x)
265
+ return sequence
266
+
267
+ def __len__(self):
268
+ return self.c_sequence.size()
269
+
270
+ def __repr__(self):
271
+ return f"<ItemSequence ({len(self)})>"
@@ -0,0 +1,27 @@
1
+ The BSD license.
2
+
3
+ Copyright (c) 2007-2010, Naoaki Okazaki
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 met:
8
+ * Redistributions of source code must retain the above copyright
9
+ notice, this list of conditions and the following disclaimer.
10
+ * Redistributions in binary form must reproduce the above copyright
11
+ notice, this list of conditions and the following disclaimer in the
12
+ documentation and/or other materials provided with the distribution.
13
+ * Neither the names of the authors nor the names of its contributors
14
+ may be used to endorse or promote products derived from this
15
+ software without specific prior written permission.
16
+
17
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
21
+ OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
24
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
25
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,183 @@
1
+ CRFsuite
2
+ Version 0.12
3
+ http://www.chokkan.org/software/crfsuite/
4
+
5
+
6
+
7
+ * INTRODUCTION
8
+ CRFSuite is an implementation of Conditional Random Fields (CRFs) for
9
+ labeling sequential data. Please refer to the web site for more
10
+ information about this software.
11
+
12
+
13
+
14
+ * COPYRIGHT AND LICENSING INFORMATION
15
+
16
+ This program is distributed under the modified BSD license. Refer to
17
+ COPYING file for the precise description of the license.
18
+
19
+
20
+ Portions of this software are based on libLBFGS.
21
+
22
+ The MIT License
23
+
24
+ Copyright (c) 1990 Jorge Nocedal
25
+ Copyright (c) 2007 Naoaki Okazaki
26
+
27
+ Permission is hereby granted, free of charge, to any person obtaining a
28
+ copy of this software and associated documentation files (the "Software"),
29
+ to deal in the Software without restriction, including without limitation
30
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
31
+ and/or sell copies of the Software, and to permit persons to whom the
32
+ Software is furnished to do so, subject to the following conditions:
33
+
34
+ The above copyright notice and this permission notice shall be included in
35
+ all copies or substantial portions of the Software.
36
+
37
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
38
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
39
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
40
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
41
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
42
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
43
+ THE SOFTWARE.
44
+
45
+
46
+ Portions of this software are based on Constant Quark Database (CQDB).
47
+
48
+ The BSD license.
49
+
50
+ Copyright (c) 2007, Naoaki Okazaki
51
+ All rights reserved.
52
+
53
+ Redistribution and use in source and binary forms, with or without
54
+ modification, are permitted provided that the following conditions are met:
55
+ * Redistributions of source code must retain the above copyright
56
+ notice, this list of conditions and the following disclaimer.
57
+ * Redistributions in binary form must reproduce the above copyright
58
+ notice, this list of conditions and the following disclaimer in the
59
+ documentation and/or other materials provided with the distribution.
60
+ * Neither the name of the Northwestern University, University of Tokyo,
61
+ nor the names of its contributors may be used to endorse or promote
62
+ products derived from this software without specific prior written
63
+ permission.
64
+
65
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
66
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
67
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
68
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
69
+ OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
70
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
71
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
72
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
73
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
74
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
75
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
76
+
77
+
78
+ Portions of this software are based on RumAVL.
79
+
80
+ MIT/X Consortium License.
81
+
82
+ Copyright (c) 2005-2007 Jesse Long <jpl@unknown.za.net>
83
+ All rights reserved.
84
+
85
+ Permission is hereby granted, free of charge, to any person obtaining a
86
+ copy of this software and associated documentation files (the "Software"),
87
+ to deal in the Software without restriction, including without limitation
88
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
89
+ and/or sell copies of the Software, and to permit persons to whom the
90
+ Software is furnished to do so, subject to the following conditions:
91
+
92
+ 1. The above copyright notice and this permission notice shall be
93
+ included in all copies or substantial portions of the Software.
94
+ 2. The origin of the Software must not be misrepresented; you must not
95
+ claim that you wrote the original Software.
96
+ 3. Altered source versions of the Software must be plainly marked as
97
+ such, and must not be misrepresented as being the original Software.
98
+
99
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
100
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
101
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
102
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
103
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
104
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
105
+ DEALINGS IN THE SOFTWARE.
106
+
107
+
108
+ Portions of this software are based on a portable stdint.h (for MSVC).
109
+
110
+ Copyright (c) 2005-2007 Paul Hsieh
111
+
112
+ Redistribution and use in source and binary forms, with or without
113
+ modification, are permitted provided that the following conditions
114
+ are met:
115
+
116
+ Redistributions of source code must retain the above copyright
117
+ notice, this list of conditions and the following disclaimer.
118
+
119
+ Redistributions in binary form must not misrepresent the orignal
120
+ source in the documentation and/or other materials provided
121
+ with the distribution.
122
+
123
+ The names of the authors nor its contributors may be used to
124
+ endorse or promote products derived from this software without
125
+ specific prior written permission.
126
+
127
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
128
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
129
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
130
+ FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
131
+ COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
132
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
133
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
134
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
135
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
136
+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
137
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
138
+ OF THE POSSIBILITY OF SUCH DAMAGE.
139
+
140
+
141
+ Portions of this software are based on Mersenne Twister.
142
+
143
+ Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
144
+ All rights reserved.
145
+
146
+ Redistribution and use in source and binary forms, with or without
147
+ modification, are permitted provided that the following conditions
148
+ are met:
149
+
150
+ 1. Redistributions of source code must retain the above copyright
151
+ notice, this list of conditions and the following disclaimer.
152
+
153
+ 2. Redistributions in binary form must reproduce the above copyright
154
+ notice, this list of conditions and the following disclaimer in the
155
+ documentation and/or other materials provided with the distribution.
156
+
157
+ 3. The names of its contributors may not be used to endorse or promote
158
+ products derived from this software without specific prior written
159
+ permission.
160
+
161
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
162
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
163
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
164
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
165
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
166
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
167
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
168
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
169
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
170
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
171
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
172
+
173
+
174
+
175
+ * SPECIAL THANKS GOES TO...
176
+ Olivier Grisel
177
+ Andreas Holzbach
178
+ Baoli Li
179
+ Yoshimasa Tsuruoka
180
+ Hiroshi Manabe
181
+ Riza Theresa B. Batista-Navarro
182
+
183
+