opener-opinion-detector-basic 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (148) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -0
  3. data/ext/hack/Rakefile +0 -2
  4. data/lib/opener/opinion_detector_basic/version.rb +1 -1
  5. data/opener-opinion-detector-basic.gemspec +0 -1
  6. data/task/compile.rake +1 -1
  7. data/task/requirements.rake +0 -1
  8. metadata +2 -142
  9. data/core/vendor/src/crfsuite/AUTHORS +0 -1
  10. data/core/vendor/src/crfsuite/COPYING +0 -27
  11. data/core/vendor/src/crfsuite/ChangeLog +0 -103
  12. data/core/vendor/src/crfsuite/INSTALL +0 -236
  13. data/core/vendor/src/crfsuite/Makefile.am +0 -19
  14. data/core/vendor/src/crfsuite/Makefile.in +0 -783
  15. data/core/vendor/src/crfsuite/README +0 -183
  16. data/core/vendor/src/crfsuite/aclocal.m4 +0 -9018
  17. data/core/vendor/src/crfsuite/autogen.sh +0 -38
  18. data/core/vendor/src/crfsuite/compile +0 -143
  19. data/core/vendor/src/crfsuite/config.guess +0 -1502
  20. data/core/vendor/src/crfsuite/config.h.in +0 -198
  21. data/core/vendor/src/crfsuite/config.sub +0 -1714
  22. data/core/vendor/src/crfsuite/configure +0 -14273
  23. data/core/vendor/src/crfsuite/configure.in +0 -149
  24. data/core/vendor/src/crfsuite/crfsuite.sln +0 -42
  25. data/core/vendor/src/crfsuite/depcomp +0 -630
  26. data/core/vendor/src/crfsuite/example/chunking.py +0 -49
  27. data/core/vendor/src/crfsuite/example/crfutils.py +0 -179
  28. data/core/vendor/src/crfsuite/example/ner.py +0 -270
  29. data/core/vendor/src/crfsuite/example/pos.py +0 -78
  30. data/core/vendor/src/crfsuite/example/template.py +0 -88
  31. data/core/vendor/src/crfsuite/frontend/Makefile.am +0 -29
  32. data/core/vendor/src/crfsuite/frontend/Makefile.in +0 -640
  33. data/core/vendor/src/crfsuite/frontend/dump.c +0 -116
  34. data/core/vendor/src/crfsuite/frontend/frontend.vcxproj +0 -129
  35. data/core/vendor/src/crfsuite/frontend/iwa.c +0 -273
  36. data/core/vendor/src/crfsuite/frontend/iwa.h +0 -65
  37. data/core/vendor/src/crfsuite/frontend/learn.c +0 -439
  38. data/core/vendor/src/crfsuite/frontend/main.c +0 -137
  39. data/core/vendor/src/crfsuite/frontend/option.c +0 -93
  40. data/core/vendor/src/crfsuite/frontend/option.h +0 -86
  41. data/core/vendor/src/crfsuite/frontend/readdata.h +0 -38
  42. data/core/vendor/src/crfsuite/frontend/reader.c +0 -136
  43. data/core/vendor/src/crfsuite/frontend/tag.c +0 -427
  44. data/core/vendor/src/crfsuite/genbinary.sh.in +0 -15
  45. data/core/vendor/src/crfsuite/include/Makefile.am +0 -11
  46. data/core/vendor/src/crfsuite/include/Makefile.in +0 -461
  47. data/core/vendor/src/crfsuite/include/crfsuite.h +0 -1063
  48. data/core/vendor/src/crfsuite/include/crfsuite.hpp +0 -555
  49. data/core/vendor/src/crfsuite/include/crfsuite_api.hpp +0 -400
  50. data/core/vendor/src/crfsuite/include/os.h +0 -61
  51. data/core/vendor/src/crfsuite/install-sh +0 -520
  52. data/core/vendor/src/crfsuite/lib/cqdb/COPYING +0 -28
  53. data/core/vendor/src/crfsuite/lib/cqdb/Makefile.am +0 -21
  54. data/core/vendor/src/crfsuite/lib/cqdb/Makefile.in +0 -549
  55. data/core/vendor/src/crfsuite/lib/cqdb/cqdb.vcxproj +0 -86
  56. data/core/vendor/src/crfsuite/lib/cqdb/include/cqdb.h +0 -524
  57. data/core/vendor/src/crfsuite/lib/cqdb/src/cqdb.c +0 -587
  58. data/core/vendor/src/crfsuite/lib/cqdb/src/lookup3.c +0 -976
  59. data/core/vendor/src/crfsuite/lib/crf/Makefile.am +0 -46
  60. data/core/vendor/src/crfsuite/lib/crf/Makefile.in +0 -721
  61. data/core/vendor/src/crfsuite/lib/crf/crf.vcxproj +0 -216
  62. data/core/vendor/src/crfsuite/lib/crf/src/crf1d.h +0 -353
  63. data/core/vendor/src/crfsuite/lib/crf/src/crf1d_context.c +0 -705
  64. data/core/vendor/src/crfsuite/lib/crf/src/crf1d_encode.c +0 -943
  65. data/core/vendor/src/crfsuite/lib/crf/src/crf1d_feature.c +0 -352
  66. data/core/vendor/src/crfsuite/lib/crf/src/crf1d_model.c +0 -994
  67. data/core/vendor/src/crfsuite/lib/crf/src/crf1d_tag.c +0 -550
  68. data/core/vendor/src/crfsuite/lib/crf/src/crfsuite.c +0 -492
  69. data/core/vendor/src/crfsuite/lib/crf/src/crfsuite_internal.h +0 -236
  70. data/core/vendor/src/crfsuite/lib/crf/src/crfsuite_train.c +0 -272
  71. data/core/vendor/src/crfsuite/lib/crf/src/dataset.c +0 -106
  72. data/core/vendor/src/crfsuite/lib/crf/src/dictionary.c +0 -118
  73. data/core/vendor/src/crfsuite/lib/crf/src/holdout.c +0 -80
  74. data/core/vendor/src/crfsuite/lib/crf/src/logging.c +0 -91
  75. data/core/vendor/src/crfsuite/lib/crf/src/logging.h +0 -48
  76. data/core/vendor/src/crfsuite/lib/crf/src/params.c +0 -335
  77. data/core/vendor/src/crfsuite/lib/crf/src/params.h +0 -80
  78. data/core/vendor/src/crfsuite/lib/crf/src/quark.c +0 -172
  79. data/core/vendor/src/crfsuite/lib/crf/src/quark.h +0 -46
  80. data/core/vendor/src/crfsuite/lib/crf/src/rumavl.c +0 -1107
  81. data/core/vendor/src/crfsuite/lib/crf/src/rumavl.h +0 -160
  82. data/core/vendor/src/crfsuite/lib/crf/src/train_arow.c +0 -408
  83. data/core/vendor/src/crfsuite/lib/crf/src/train_averaged_perceptron.c +0 -242
  84. data/core/vendor/src/crfsuite/lib/crf/src/train_l2sgd.c +0 -507
  85. data/core/vendor/src/crfsuite/lib/crf/src/train_lbfgs.c +0 -338
  86. data/core/vendor/src/crfsuite/lib/crf/src/train_passive_aggressive.c +0 -435
  87. data/core/vendor/src/crfsuite/lib/crf/src/vecmath.h +0 -341
  88. data/core/vendor/src/crfsuite/ltmain.sh +0 -8413
  89. data/core/vendor/src/crfsuite/missing +0 -376
  90. data/core/vendor/src/crfsuite/swig/Makefile.am +0 -13
  91. data/core/vendor/src/crfsuite/swig/Makefile.in +0 -365
  92. data/core/vendor/src/crfsuite/swig/crfsuite.cpp +0 -2
  93. data/core/vendor/src/crfsuite/swig/export.i +0 -32
  94. data/core/vendor/src/crfsuite/swig/python/README +0 -92
  95. data/core/vendor/src/crfsuite/swig/python/crfsuite.py +0 -329
  96. data/core/vendor/src/crfsuite/swig/python/export_wrap.cpp +0 -14355
  97. data/core/vendor/src/crfsuite/swig/python/export_wrap.h +0 -63
  98. data/core/vendor/src/crfsuite/swig/python/prepare.sh +0 -9
  99. data/core/vendor/src/crfsuite/swig/python/sample_tag.py +0 -52
  100. data/core/vendor/src/crfsuite/swig/python/sample_train.py +0 -68
  101. data/core/vendor/src/crfsuite/swig/python/setup.py +0 -44
  102. data/core/vendor/src/crfsuite/win32/stdint.h +0 -679
  103. data/core/vendor/src/liblbfgs/AUTHORS +0 -1
  104. data/core/vendor/src/liblbfgs/COPYING +0 -22
  105. data/core/vendor/src/liblbfgs/ChangeLog +0 -120
  106. data/core/vendor/src/liblbfgs/INSTALL +0 -231
  107. data/core/vendor/src/liblbfgs/Makefile.am +0 -10
  108. data/core/vendor/src/liblbfgs/Makefile.in +0 -638
  109. data/core/vendor/src/liblbfgs/NEWS +0 -0
  110. data/core/vendor/src/liblbfgs/README +0 -71
  111. data/core/vendor/src/liblbfgs/aclocal.m4 +0 -6985
  112. data/core/vendor/src/liblbfgs/autogen.sh +0 -38
  113. data/core/vendor/src/liblbfgs/config.guess +0 -1411
  114. data/core/vendor/src/liblbfgs/config.h.in +0 -64
  115. data/core/vendor/src/liblbfgs/config.sub +0 -1500
  116. data/core/vendor/src/liblbfgs/configure +0 -21146
  117. data/core/vendor/src/liblbfgs/configure.in +0 -107
  118. data/core/vendor/src/liblbfgs/depcomp +0 -522
  119. data/core/vendor/src/liblbfgs/include/lbfgs.h +0 -745
  120. data/core/vendor/src/liblbfgs/install-sh +0 -322
  121. data/core/vendor/src/liblbfgs/lbfgs.sln +0 -26
  122. data/core/vendor/src/liblbfgs/lib/Makefile.am +0 -24
  123. data/core/vendor/src/liblbfgs/lib/Makefile.in +0 -499
  124. data/core/vendor/src/liblbfgs/lib/arithmetic_ansi.h +0 -133
  125. data/core/vendor/src/liblbfgs/lib/arithmetic_sse_double.h +0 -294
  126. data/core/vendor/src/liblbfgs/lib/arithmetic_sse_float.h +0 -298
  127. data/core/vendor/src/liblbfgs/lib/lbfgs.c +0 -1371
  128. data/core/vendor/src/liblbfgs/lib/lib.vcxproj +0 -95
  129. data/core/vendor/src/liblbfgs/ltmain.sh +0 -6426
  130. data/core/vendor/src/liblbfgs/missing +0 -353
  131. data/core/vendor/src/liblbfgs/sample/Makefile.am +0 -15
  132. data/core/vendor/src/liblbfgs/sample/Makefile.in +0 -433
  133. data/core/vendor/src/liblbfgs/sample/sample.c +0 -81
  134. data/core/vendor/src/liblbfgs/sample/sample.cpp +0 -126
  135. data/core/vendor/src/liblbfgs/sample/sample.vcxproj +0 -105
  136. data/core/vendor/src/svm_light/LICENSE.txt +0 -59
  137. data/core/vendor/src/svm_light/Makefile +0 -105
  138. data/core/vendor/src/svm_light/kernel.h +0 -40
  139. data/core/vendor/src/svm_light/svm_classify.c +0 -197
  140. data/core/vendor/src/svm_light/svm_common.c +0 -985
  141. data/core/vendor/src/svm_light/svm_common.h +0 -301
  142. data/core/vendor/src/svm_light/svm_hideo.c +0 -1062
  143. data/core/vendor/src/svm_light/svm_learn.c +0 -4147
  144. data/core/vendor/src/svm_light/svm_learn.h +0 -169
  145. data/core/vendor/src/svm_light/svm_learn_main.c +0 -397
  146. data/core/vendor/src/svm_light/svm_loqo.c +0 -211
  147. data/task/c.rake +0 -36
  148. data/task/submodules.rake +0 -5
@@ -1,301 +0,0 @@
1
- /************************************************************************/
2
- /* */
3
- /* svm_common.h */
4
- /* */
5
- /* Definitions and functions used in both svm_learn and svm_classify. */
6
- /* */
7
- /* Author: Thorsten Joachims */
8
- /* Date: 02.07.02 */
9
- /* */
10
- /* Copyright (c) 2002 Thorsten Joachims - All rights reserved */
11
- /* */
12
- /* This software is available for non-commercial use only. It must */
13
- /* not be modified and distributed without prior permission of the */
14
- /* author. The author is not responsible for implications from the */
15
- /* use of this software. */
16
- /* */
17
- /************************************************************************/
18
-
19
- #ifndef SVM_COMMON
20
- #define SVM_COMMON
21
-
22
- # include <stdio.h>
23
- # include <ctype.h>
24
- # include <math.h>
25
- # include <string.h>
26
- # include <stdlib.h>
27
- # include <time.h>
28
- # include <float.h>
29
-
30
- # define VERSION "V6.02"
31
- # define VERSION_DATE "14.08.08"
32
-
33
- # define CFLOAT float /* the type of float to use for caching */
34
- /* kernel evaluations. Using float saves */
35
- /* us some memory, but you can use double, too */
36
- # define FNUM long /* the type used for storing feature ids */
37
- # define FVAL float /* the type used for storing feature values */
38
- # define MAXFEATNUM 99999999 /* maximum feature number (must be in
39
- valid range of FNUM type and long int!) */
40
-
41
- # define LINEAR 0 /* linear kernel type */
42
- # define POLY 1 /* polynoial kernel type */
43
- # define RBF 2 /* rbf kernel type */
44
- # define SIGMOID 3 /* sigmoid kernel type */
45
-
46
- # define CLASSIFICATION 1 /* train classification model */
47
- # define REGRESSION 2 /* train regression model */
48
- # define RANKING 3 /* train ranking model */
49
- # define OPTIMIZATION 4 /* train on general set of constraints */
50
-
51
- # define MAXSHRINK 50000 /* maximum number of shrinking rounds */
52
-
53
- typedef struct word {
54
- FNUM wnum; /* word number */
55
- FVAL weight; /* word weight */
56
- } WORD;
57
-
58
- typedef struct svector {
59
- WORD *words; /* The features/values in the vector by
60
- increasing feature-number. Feature
61
- numbers that are skipped are
62
- interpreted as having value zero. */
63
- double twonorm_sq; /* The squared euclidian length of the
64
- vector. Used to speed up the RBF kernel. */
65
- char *userdefined; /* You can put additional information
66
- here. This can be useful, if you are
67
- implementing your own kernel that
68
- does not work with feature/values
69
- representations (for example a
70
- string kernel). By default,
71
- svm-light will put here the string
72
- after the # sign from each line of
73
- the input file. */
74
- long kernel_id; /* Feature vectors with different
75
- kernel_id's are orthogonal (ie. the
76
- feature number do not match). This
77
- is used for computing component
78
- kernels for linear constraints which
79
- are a sum of several different
80
- weight vectors. (currently not
81
- implemented). */
82
- struct svector *next; /* Let's you set up a list of SVECTOR's
83
- for linear constraints which are a
84
- sum of multiple feature
85
- vectors. List is terminated by
86
- NULL. */
87
- double factor; /* Factor by which this feature vector
88
- is multiplied in the sum. */
89
- } SVECTOR;
90
-
91
- typedef struct doc {
92
- long docnum; /* Document ID. This has to be the position of
93
- the document in the training set array. */
94
- long queryid; /* for learning rankings, constraints are
95
- generated for documents with the same
96
- queryID. */
97
- double costfactor; /* Scales the cost of misclassifying this
98
- document by this factor. The effect of this
99
- value is, that the upper bound on the alpha
100
- for this example is scaled by this factor.
101
- The factors are set by the feature
102
- 'cost:<val>' in the training data. */
103
- long slackid; /* Index of the slack variable
104
- corresponding to this
105
- constraint. All constraints with the
106
- same slackid share the same slack
107
- variable. This can only be used for
108
- svm_learn_optimization. */
109
- SVECTOR *fvec; /* Feature vector of the example. The
110
- feature vector can actually be a
111
- list of feature vectors. For
112
- example, the list will have two
113
- elements, if this DOC is a
114
- preference constraint. The one
115
- vector that is supposed to be ranked
116
- higher, will have a factor of +1,
117
- the lower ranked one should have a
118
- factor of -1. */
119
- } DOC;
120
-
121
- typedef struct learn_parm {
122
- long type; /* selects between regression and
123
- classification */
124
- double svm_c; /* upper bound C on alphas */
125
- double eps; /* regression epsilon (eps=1.0 for
126
- classification */
127
- double svm_costratio; /* factor to multiply C for positive examples */
128
- double transduction_posratio;/* fraction of unlabeled examples to be */
129
- /* classified as positives */
130
- long biased_hyperplane; /* if nonzero, use hyperplane w*x+b=0
131
- otherwise w*x=0 */
132
- long sharedslack; /* if nonzero, it will use the shared
133
- slack variable mode in
134
- svm_learn_optimization. It requires
135
- that the slackid is set for every
136
- training example */
137
- long svm_maxqpsize; /* size q of working set */
138
- long svm_newvarsinqp; /* new variables to enter the working set
139
- in each iteration */
140
- long kernel_cache_size; /* size of kernel cache in megabytes */
141
- double epsilon_crit; /* tolerable error for distances used
142
- in stopping criterion */
143
- double epsilon_shrink; /* how much a multiplier should be above
144
- zero for shrinking */
145
- long svm_iter_to_shrink; /* iterations h after which an example can
146
- be removed by shrinking */
147
- long maxiter; /* number of iterations after which the
148
- optimizer terminates, if there was
149
- no progress in maxdiff */
150
- long remove_inconsistent; /* exclude examples with alpha at C and
151
- retrain */
152
- long skip_final_opt_check; /* do not check KT-Conditions at the end of
153
- optimization for examples removed by
154
- shrinking. WARNING: This might lead to
155
- sub-optimal solutions! */
156
- long compute_loo; /* if nonzero, computes leave-one-out
157
- estimates */
158
- double rho; /* parameter in xi/alpha-estimates and for
159
- pruning leave-one-out range [1..2] */
160
- long xa_depth; /* parameter in xi/alpha-estimates upper
161
- bounding the number of SV the current
162
- alpha_t is distributed over */
163
- char predfile[200]; /* file for predicitions on unlabeled examples
164
- in transduction */
165
- char alphafile[200]; /* file to store optimal alphas in. use
166
- empty string if alphas should not be
167
- output */
168
-
169
- /* you probably do not want to touch the following */
170
- double epsilon_const; /* tolerable error on eq-constraint */
171
- double epsilon_a; /* tolerable error on alphas at bounds */
172
- double opt_precision; /* precision of solver, set to e.g. 1e-21
173
- if you get convergence problems */
174
-
175
- /* the following are only for internal use */
176
- long svm_c_steps; /* do so many steps for finding optimal C */
177
- double svm_c_factor; /* increase C by this factor every step */
178
- double svm_costratio_unlab;
179
- double svm_unlabbound;
180
- double *svm_cost; /* individual upper bounds for each var */
181
- long totwords; /* number of features */
182
- } LEARN_PARM;
183
-
184
- typedef struct kernel_parm {
185
- long kernel_type; /* 0=linear, 1=poly, 2=rbf, 3=sigmoid, 4=custom */
186
- long poly_degree;
187
- double rbf_gamma;
188
- double coef_lin;
189
- double coef_const;
190
- char custom[50]; /* for user supplied kernel */
191
- } KERNEL_PARM;
192
-
193
- typedef struct model {
194
- long sv_num;
195
- long at_upper_bound;
196
- double b;
197
- DOC **supvec;
198
- double *alpha;
199
- long *index; /* index from docnum to position in model */
200
- long totwords; /* number of features */
201
- long totdoc; /* number of training documents */
202
- KERNEL_PARM kernel_parm; /* kernel */
203
-
204
- /* the following values are not written to file */
205
- double loo_error,loo_recall,loo_precision; /* leave-one-out estimates */
206
- double xa_error,xa_recall,xa_precision; /* xi/alpha estimates */
207
- double *lin_weights; /* weights for linear case using
208
- folding */
209
- double maxdiff; /* precision, up to which this
210
- model is accurate */
211
- } MODEL;
212
-
213
- typedef struct quadratic_program {
214
- long opt_n; /* number of variables */
215
- long opt_m; /* number of linear equality constraints */
216
- double *opt_ce,*opt_ce0; /* linear equality constraints */
217
- double *opt_g; /* hessian of objective */
218
- double *opt_g0; /* linear part of objective */
219
- double *opt_xinit; /* initial value for variables */
220
- double *opt_low,*opt_up; /* box constraints */
221
- } QP;
222
-
223
- typedef struct kernel_cache {
224
- long *index; /* cache some kernel evalutations */
225
- CFLOAT *buffer; /* to improve speed */
226
- long *invindex;
227
- long *active2totdoc;
228
- long *totdoc2active;
229
- long *lru;
230
- long *occu;
231
- long elems;
232
- long max_elems;
233
- long time;
234
- long activenum;
235
- long buffsize;
236
- } KERNEL_CACHE;
237
-
238
-
239
- typedef struct timing_profile {
240
- long time_kernel;
241
- long time_opti;
242
- long time_shrink;
243
- long time_update;
244
- long time_model;
245
- long time_check;
246
- long time_select;
247
- } TIMING;
248
-
249
- typedef struct shrink_state {
250
- long *active;
251
- long *inactive_since;
252
- long deactnum;
253
- double **a_history; /* for shrinking with non-linear kernel */
254
- long maxhistory;
255
- double *last_a; /* for shrinking with linear kernel */
256
- double *last_lin; /* for shrinking with linear kernel */
257
- } SHRINK_STATE;
258
-
259
- double classify_example(MODEL *, DOC *);
260
- double classify_example_linear(MODEL *, DOC *);
261
- double kernel(KERNEL_PARM *, DOC *, DOC *);
262
- double single_kernel(KERNEL_PARM *, SVECTOR *, SVECTOR *);
263
- double custom_kernel(KERNEL_PARM *, SVECTOR *, SVECTOR *);
264
- SVECTOR *create_svector(WORD *, char *, double);
265
- SVECTOR *copy_svector(SVECTOR *);
266
- void free_svector(SVECTOR *);
267
- double sprod_ss(SVECTOR *, SVECTOR *);
268
- SVECTOR* sub_ss(SVECTOR *, SVECTOR *);
269
- SVECTOR* add_ss(SVECTOR *, SVECTOR *);
270
- SVECTOR* add_list_ss(SVECTOR *);
271
- void append_svector_list(SVECTOR *a, SVECTOR *b);
272
- SVECTOR* smult_s(SVECTOR *, double);
273
- int featvec_eq(SVECTOR *, SVECTOR *);
274
- double model_length_s(MODEL *, KERNEL_PARM *);
275
- void clear_vector_n(double *, long);
276
- void add_vector_ns(double *, SVECTOR *, double);
277
- double sprod_ns(double *, SVECTOR *);
278
- void add_weight_vector_to_linear_model(MODEL *);
279
- DOC *create_example(long, long, long, double, SVECTOR *);
280
- void free_example(DOC *, long);
281
- MODEL *read_model(char *);
282
- MODEL *copy_model(MODEL *);
283
- void free_model(MODEL *, int);
284
- void read_documents(char *, DOC ***, double **, long *, long *);
285
- int parse_document(char *, WORD *, double *, long *, long *, double *, long *, long, char **);
286
- double *read_alphas(char *,long);
287
- void nol_ll(char *, long *, long *, long *);
288
- long minl(long, long);
289
- long maxl(long, long);
290
- long get_runtime(void);
291
- int space_or_null(int);
292
- void *my_malloc(size_t);
293
- void copyright_notice(void);
294
- # ifdef _MSC_VER
295
- int isnan(double);
296
- # endif
297
-
298
- extern long verbosity; /* verbosity level (0-4) */
299
- extern long kernel_cache_statistic;
300
-
301
- #endif