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,116 +0,0 @@
1
- /*
2
- * Dump command for CRFsuite frontend.
3
- *
4
- * Copyright (c) 2007-2010, Naoaki Okazaki
5
- * All rights reserved.
6
- *
7
- * Redistribution and use in source and binary forms, with or without
8
- * modification, are permitted provided that the following conditions are met:
9
- * * Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- * * Redistributions in binary form must reproduce the above copyright
12
- * notice, this list of conditions and the following disclaimer in the
13
- * documentation and/or other materials provided with the distribution.
14
- * * Neither the names of the authors nor the names of its contributors
15
- * may be used to endorse or promote products derived from this
16
- * software without specific prior written permission.
17
- *
18
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
22
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
-
31
- /* $Id$ */
32
-
33
- #include <os.h>
34
-
35
- #include <stdio.h>
36
- #include <stdlib.h>
37
- #include <string.h>
38
-
39
- #include <crfsuite.h>
40
- #include "option.h"
41
-
42
- #define SAFE_RELEASE(obj) if ((obj) != NULL) { (obj)->release(obj); (obj) = NULL; }
43
-
44
- typedef struct {
45
- int help;
46
- } dump_option_t;
47
-
48
- static void dump_option_init(dump_option_t* opt)
49
- {
50
- memset(opt, 0, sizeof(*opt));
51
- }
52
-
53
- static void dump_option_finish(dump_option_t* opt)
54
- {
55
- }
56
-
57
- BEGIN_OPTION_MAP(parse_dump_options, dump_option_t)
58
-
59
- ON_OPTION(SHORTOPT('h') || LONGOPT("help"))
60
- opt->help = 1;
61
-
62
- END_OPTION_MAP()
63
-
64
- static void show_usage(FILE *fp, const char *argv0, const char *command)
65
- {
66
- fprintf(fp, "USAGE: %s %s [OPTIONS] <MODEL>\n", argv0, command);
67
- fprintf(fp, "Output the model stored in the file (MODEL) in a plain-text format\n");
68
- fprintf(fp, "\n");
69
- fprintf(fp, "OPTIONS:\n");
70
- fprintf(fp, " -h, --help Show the usage of this command and exit\n");
71
- }
72
-
73
- int main_dump(int argc, char *argv[], const char *argv0)
74
- {
75
- int ret = 0, arg_used = 0;
76
- dump_option_t opt;
77
- const char *command = argv[0];
78
- FILE *fp = NULL, *fpi = stdin, *fpo = stdout, *fpe = stderr;
79
- crfsuite_model_t *model = NULL;
80
-
81
- /* Parse the command-line option. */
82
- dump_option_init(&opt);
83
- arg_used = option_parse(++argv, --argc, parse_dump_options, &opt);
84
- if (arg_used < 0) {
85
- ret = 1;
86
- goto force_exit;
87
- }
88
-
89
- /* Show the help message for this command if specified. */
90
- if (opt.help) {
91
- show_usage(fpo, argv0, command);
92
- goto force_exit;
93
- }
94
-
95
- /* Check for the existence of the model file. */
96
- if (argc <= arg_used) {
97
- fprintf(fpe, "ERROR: No model specified.\n");
98
- ret = 1;
99
- goto force_exit;
100
- }
101
-
102
- /* Create a model instance corresponding to the model file. */
103
- if (ret = crfsuite_create_instance_from_file(argv[arg_used], (void**)&model)) {
104
- goto force_exit;
105
- }
106
-
107
- /* Dump the model. */
108
- if (ret = model->dump(model, fpo)) {
109
- goto force_exit;
110
- }
111
-
112
- force_exit:
113
- SAFE_RELEASE(model);
114
- dump_option_finish(&opt);
115
- return ret;
116
- }
@@ -1,129 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
- <ItemGroup Label="ProjectConfigurations">
4
- <ProjectConfiguration Include="Debug|Win32">
5
- <Configuration>Debug</Configuration>
6
- <Platform>Win32</Platform>
7
- </ProjectConfiguration>
8
- <ProjectConfiguration Include="Release|Win32">
9
- <Configuration>Release</Configuration>
10
- <Platform>Win32</Platform>
11
- </ProjectConfiguration>
12
- </ItemGroup>
13
- <PropertyGroup Label="Globals">
14
- <ProjectGuid>{CEC83336-7B18-408B-9F3C-D11225609540}</ProjectGuid>
15
- <RootNamespace>frontend</RootNamespace>
16
- <Keyword>Win32Proj</Keyword>
17
- </PropertyGroup>
18
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
19
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
20
- <ConfigurationType>Application</ConfigurationType>
21
- <CharacterSet>Unicode</CharacterSet>
22
- <WholeProgramOptimization>true</WholeProgramOptimization>
23
- </PropertyGroup>
24
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
25
- <ConfigurationType>Application</ConfigurationType>
26
- <CharacterSet>Unicode</CharacterSet>
27
- </PropertyGroup>
28
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
29
- <ImportGroup Label="ExtensionSettings">
30
- </ImportGroup>
31
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
32
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
33
- </ImportGroup>
34
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
35
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
36
- </ImportGroup>
37
- <PropertyGroup Label="UserMacros" />
38
- <PropertyGroup>
39
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
40
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
41
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
42
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
43
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
44
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
45
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
46
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
47
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
48
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
49
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
50
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
51
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
52
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionName)</TargetName>
53
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionName)</TargetName>
54
- </PropertyGroup>
55
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
56
- <ClCompile>
57
- <Optimization>Disabled</Optimization>
58
- <AdditionalIncludeDirectories>$(SolutionDir)include;$(SolutionDir)win32;$(SolutionDir)lib\crf\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
59
- <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
60
- <MinimalRebuild>true</MinimalRebuild>
61
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
62
- <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
63
- <FloatingPointModel>Strict</FloatingPointModel>
64
- <FloatingPointExceptions>true</FloatingPointExceptions>
65
- <PrecompiledHeader>
66
- </PrecompiledHeader>
67
- <WarningLevel>Level3</WarningLevel>
68
- <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
69
- </ClCompile>
70
- <Link>
71
- <GenerateDebugInformation>true</GenerateDebugInformation>
72
- <SubSystem>Console</SubSystem>
73
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
74
- <DataExecutionPrevention>
75
- </DataExecutionPrevention>
76
- <TargetMachine>MachineX86</TargetMachine>
77
- </Link>
78
- </ItemDefinitionGroup>
79
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
80
- <ClCompile>
81
- <Optimization>Full</Optimization>
82
- <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
83
- <IntrinsicFunctions>true</IntrinsicFunctions>
84
- <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
85
- <AdditionalIncludeDirectories>$(SolutionDir)include;$(SolutionDir)win32;$(SolutionDir)lib\crf\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
86
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
87
- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
88
- <FloatingPointExceptions>true</FloatingPointExceptions>
89
- <PrecompiledHeader>
90
- </PrecompiledHeader>
91
- <WarningLevel>Level1</WarningLevel>
92
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
93
- </ClCompile>
94
- <Link>
95
- <GenerateDebugInformation>true</GenerateDebugInformation>
96
- <SubSystem>Console</SubSystem>
97
- <OptimizeReferences>true</OptimizeReferences>
98
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
99
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
100
- <DataExecutionPrevention>
101
- </DataExecutionPrevention>
102
- <TargetMachine>MachineX86</TargetMachine>
103
- </Link>
104
- </ItemDefinitionGroup>
105
- <ItemGroup>
106
- <ClCompile Include="dump.c" />
107
- <ClCompile Include="iwa.c" />
108
- <ClCompile Include="learn.c" />
109
- <ClCompile Include="main.c" />
110
- <ClCompile Include="option.c" />
111
- <ClCompile Include="reader.c" />
112
- <ClCompile Include="tag.c" />
113
- </ItemGroup>
114
- <ItemGroup>
115
- <ClInclude Include="iwa.h" />
116
- <ClInclude Include="option.h" />
117
- <ClInclude Include="..\include\os.h" />
118
- <ClInclude Include="readdata.h" />
119
- </ItemGroup>
120
- <ItemGroup>
121
- <ProjectReference Include="..\lib\crf\crf.vcxproj">
122
- <Project>{d6b16f2e-da86-4591-8b50-348ab7e3432e}</Project>
123
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
124
- </ProjectReference>
125
- </ItemGroup>
126
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
127
- <ImportGroup Label="ExtensionTargets">
128
- </ImportGroup>
129
- </Project>
@@ -1,273 +0,0 @@
1
- /*
2
- * A parser for Item With Attributes (IWA) format.
3
- *
4
- * Copyright (c) 2007-2010, Naoaki Okazaki
5
- * All rights reserved.
6
- *
7
- * Redistribution and use in source and binary forms, with or without
8
- * modification, are permitted provided that the following conditions are met:
9
- * * Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- * * Redistributions in binary form must reproduce the above copyright
12
- * notice, this list of conditions and the following disclaimer in the
13
- * documentation and/or other materials provided with the distribution.
14
- * * Neither the names of the authors nor the names of its contributors
15
- * may be used to endorse or promote products derived from this
16
- * software without specific prior written permission.
17
- *
18
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
22
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
-
31
- /* $Id$ */
32
-
33
- #include <stdio.h>
34
- #include <stdlib.h>
35
- #include <string.h>
36
-
37
- #include "iwa.h"
38
-
39
- typedef struct {
40
- size_t size;
41
- size_t offset;
42
- char *value;
43
- } iwa_string_t;
44
-
45
- struct tag_iwa {
46
- FILE *fp;
47
-
48
- iwa_token_t token;
49
-
50
- char *buffer;
51
- char *offset;
52
- char *end;
53
-
54
- iwa_string_t attr;
55
- iwa_string_t value;
56
- };
57
-
58
- #define DEFAULT_SIZE 4096
59
- #define BUFFER_SIZE (DEFAULT_SIZE * 16)
60
-
61
- static void string_init(iwa_string_t* str)
62
- {
63
- str->value = (char*)calloc(DEFAULT_SIZE, sizeof(char));
64
- str->size = DEFAULT_SIZE;
65
- str->offset = 0;
66
- }
67
-
68
- static void string_finish(iwa_string_t* str)
69
- {
70
- free(str->value);
71
- memset(str, 0, sizeof(*str));
72
- }
73
-
74
- static void string_clear(iwa_string_t* str)
75
- {
76
- memset(str->value, 0, str->size);
77
- str->offset = 0;
78
- }
79
-
80
- static void string_append(iwa_string_t* str, int c)
81
- {
82
- if (str->size <= str->offset) {
83
- str->size *= 2;
84
- str->value = (char*)realloc(str->value, str->size);
85
- memset(&str->value[str->offset], 0, str->size - str->offset);
86
- }
87
- str->value[str->offset++] = c;
88
- }
89
-
90
- iwa_t* iwa_reader(FILE *fp)
91
- {
92
- iwa_t* iwa = (iwa_t*)malloc(sizeof(iwa_t));
93
-
94
- if (iwa == NULL) {
95
- goto error_exit;
96
- }
97
-
98
- memset(iwa, 0, sizeof(iwa_t));
99
-
100
- iwa->fp = fp;
101
-
102
- iwa->buffer = (char*)malloc(sizeof(char) * BUFFER_SIZE);
103
- iwa->offset = iwa->buffer + BUFFER_SIZE;
104
- iwa->end = iwa->buffer + BUFFER_SIZE;
105
- if (iwa->buffer == NULL) {
106
- goto error_exit;
107
- }
108
-
109
- string_init(&iwa->attr);
110
- string_init(&iwa->value);
111
-
112
- return iwa;
113
-
114
- error_exit:
115
- iwa_delete(iwa);
116
- return NULL;
117
- }
118
-
119
- void iwa_delete(iwa_t* iwa)
120
- {
121
- if (iwa != NULL) {
122
- string_finish(&iwa->value);
123
- string_finish(&iwa->attr);
124
- free(iwa->buffer);
125
- }
126
- free(iwa);
127
- }
128
-
129
- static int peek_char(iwa_t* iwa)
130
- {
131
- /* Refill the buffer if necessary. */
132
- if (iwa->end <= iwa->offset) {
133
- size_t count = fread(iwa->buffer, sizeof(char), BUFFER_SIZE, iwa->fp);
134
- iwa->offset = iwa->buffer;
135
- iwa->end = iwa->buffer + count;
136
- if (count == 0) {
137
- return EOF;
138
- }
139
- }
140
-
141
- /* Return the current character */
142
- return *iwa->offset;
143
- }
144
-
145
- static int get_char(iwa_t* iwa)
146
- {
147
- int c = peek_char(iwa);
148
- if (c != EOF) {
149
- ++iwa->offset;
150
- }
151
- return c;
152
- }
153
-
154
- static void read_field_unquoted(iwa_t* iwa, iwa_string_t* str)
155
- {
156
- int c;
157
- /* Read until a colon, space, tab, or break-line character. */
158
- while (c = peek_char(iwa), c != ':' && c != '\t' && c != '\n' && c != EOF) {
159
- get_char(iwa);
160
- string_append(str, c);
161
- }
162
- /* The input stream points to the character just after the field is terminated. */
163
- }
164
-
165
- static void read_field_unescaped(iwa_t* iwa, iwa_string_t* str)
166
- {
167
- int c, d;
168
- /* Read until a colon, space, tab, or break-line character. */
169
- while (c = peek_char(iwa), c != ':' && c != '\t' && c != '\n' && c != EOF) {
170
- get_char(iwa);
171
- if (c == '\\') {
172
- /* Possibly a escape sequence. */
173
- d = peek_char(iwa);
174
- switch (d) {
175
- case ':':
176
- case '\\':
177
- c = d;
178
- get_char(iwa);
179
- break;
180
- }
181
- }
182
-
183
- string_append(str, c);
184
- }
185
- /* The input stream points to the character just after the field is terminated. */
186
- }
187
-
188
- static int read_item(iwa_t* iwa)
189
- {
190
- int c;
191
-
192
- read_field_unescaped(iwa, &iwa->attr);
193
-
194
- /* Check the character just after the attribute field is terminated. */
195
- c = peek_char(iwa);
196
- if (c == ':') {
197
- /* Discard the colon. */
198
- get_char(iwa);
199
-
200
- read_field_unescaped(iwa, &iwa->value);
201
-
202
- c = peek_char(iwa);
203
- if (c == ':') {
204
- return 1;
205
- }
206
- }
207
-
208
- return 0;
209
- }
210
-
211
- const iwa_token_t* iwa_read(iwa_t* iwa)
212
- {
213
- iwa_token_t* token = &iwa->token;
214
-
215
- /* Initialization. */
216
- token->attr = NULL;
217
- token->value = NULL;
218
- string_clear(&iwa->attr);
219
- string_clear(&iwa->value);
220
-
221
- /* Return NULL if the stream hits EOF. */
222
- if (peek_char(iwa) == EOF) {
223
- switch (token->type) {
224
- case IWA_EOF:
225
- return NULL;
226
- case IWA_BOI:
227
- token->type = IWA_EOI;
228
- return token;
229
- case IWA_NONE:
230
- case IWA_EOI:
231
- token->type = IWA_EOF;
232
- return token;
233
- }
234
- }
235
-
236
- /* Conditions based on the previous state. */
237
- switch (token->type) {
238
- case IWA_NONE:
239
- case IWA_EOI:
240
- if (peek_char(iwa) == '\n') {
241
- /* A empty line. */
242
- get_char(iwa);
243
- token->type = IWA_NONE;
244
- } else {
245
- /* A non-empty line. */
246
- token->type = IWA_BOI;
247
- }
248
- break;
249
- case IWA_BOI:
250
- case IWA_ITEM:
251
- for (;;) {
252
- int c = peek_char(iwa);
253
-
254
- if (c == '\t') {
255
- /* Skip white spaces. */
256
- get_char(iwa);
257
- } else if (c == '\n') {
258
- get_char(iwa);
259
- token->type = IWA_EOI;
260
- break;
261
- } else {
262
- read_item(iwa);
263
- token->type = IWA_ITEM;
264
- token->attr = iwa->attr.value;
265
- token->value = iwa->value.value;
266
- break;
267
- }
268
- }
269
- break;
270
- }
271
-
272
- return token;
273
- }
@@ -1,65 +0,0 @@
1
- /*
2
- * A parser for Item With Attributes (IWA) format.
3
- *
4
- * Copyright (c) 2007-2010, Naoaki Okazaki
5
- * All rights reserved.
6
- *
7
- * Redistribution and use in source and binary forms, with or without
8
- * modification, are permitted provided that the following conditions are met:
9
- * * Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- * * Redistributions in binary form must reproduce the above copyright
12
- * notice, this list of conditions and the following disclaimer in the
13
- * documentation and/or other materials provided with the distribution.
14
- * * Neither the names of the authors nor the names of its contributors
15
- * may be used to endorse or promote products derived from this
16
- * software without specific prior written permission.
17
- *
18
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
22
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
-
31
- /* $Id$ */
32
-
33
- #ifndef __IWA_H__
34
- #define __IWA_H__
35
-
36
- #ifdef __cplusplus
37
- extern "C" {
38
- #endif/*__cplusplus*/
39
-
40
- typedef struct tag_iwa iwa_t;
41
-
42
- enum {
43
- IWA_NONE,
44
- IWA_EOF,
45
- IWA_BOI,
46
- IWA_EOI,
47
- IWA_ITEM,
48
- };
49
-
50
- struct tag_iwa_token {
51
- int type;
52
- const char *attr;
53
- const char *value;
54
- };
55
- typedef struct tag_iwa_token iwa_token_t;
56
-
57
- iwa_t* iwa_reader(FILE *fp);
58
- const iwa_token_t* iwa_read(iwa_t* iwa);
59
- void iwa_delete(iwa_t* iwa);
60
-
61
- #ifdef __cplusplus
62
- }
63
- #endif/*__cplusplus*/
64
-
65
- #endif/*__IWA_H__*/