cld3 3.2.4 → 3.2.5
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.
- checksums.yaml +4 -4
- data/cld3.gemspec +4 -4
- data/ext/cld3/ext/CMakeLists.txt +69 -0
- data/ext/cld3/ext/CONTRIBUTING.md +26 -0
- data/{LICENSE_CLD3 → ext/cld3/ext/LICENSE} +0 -0
- data/ext/cld3/ext/README.md +73 -0
- data/ext/cld3/ext/misc/myprotobuf.cmake +58 -0
- data/ext/cld3/ext/model.png +0 -0
- data/ext/cld3/ext/src/BUILD.gn +133 -0
- data/ext/cld3/ext/src/DEPS +4 -0
- data/ext/cld3/{base.cc → ext/src/base.cc} +0 -0
- data/ext/cld3/{base.h → ext/src/base.h} +0 -0
- data/ext/cld3/{casts.h → ext/src/casts.h} +0 -0
- data/ext/cld3/{embedding_feature_extractor.cc → ext/src/embedding_feature_extractor.cc} +0 -0
- data/ext/cld3/{embedding_feature_extractor.h → ext/src/embedding_feature_extractor.h} +0 -0
- data/ext/cld3/{embedding_network.cc → ext/src/embedding_network.cc} +0 -0
- data/ext/cld3/{embedding_network.h → ext/src/embedding_network.h} +0 -0
- data/ext/cld3/{embedding_network_params.h → ext/src/embedding_network_params.h} +0 -0
- data/ext/cld3/{feature_extractor.cc → ext/src/feature_extractor.cc} +0 -0
- data/ext/cld3/{feature_extractor.h → ext/src/feature_extractor.h} +0 -0
- data/ext/cld3/{feature_extractor.proto → ext/src/feature_extractor.proto} +0 -0
- data/ext/cld3/{feature_types.cc → ext/src/feature_types.cc} +0 -0
- data/ext/cld3/{feature_types.h → ext/src/feature_types.h} +0 -0
- data/ext/cld3/{float16.h → ext/src/float16.h} +0 -0
- data/ext/cld3/{fml_parser.cc → ext/src/fml_parser.cc} +0 -0
- data/ext/cld3/{fml_parser.h → ext/src/fml_parser.h} +0 -0
- data/ext/cld3/{lang_id_nn_params.cc → ext/src/lang_id_nn_params.cc} +0 -0
- data/ext/cld3/{lang_id_nn_params.h → ext/src/lang_id_nn_params.h} +0 -0
- data/ext/cld3/{language_identifier_features.cc → ext/src/language_identifier_features.cc} +0 -0
- data/ext/cld3/{language_identifier_features.h → ext/src/language_identifier_features.h} +0 -0
- data/ext/cld3/ext/src/language_identifier_features_test.cc +261 -0
- data/ext/cld3/ext/src/language_identifier_main.cc +54 -0
- data/ext/cld3/ext/src/nnet_lang_id_test.cc +254 -0
- data/ext/cld3/ext/src/nnet_lang_id_test_data.cc +529 -0
- data/ext/cld3/ext/src/nnet_lang_id_test_data.h +117 -0
- data/ext/cld3/{nnet_language_identifier.cc → ext/src/nnet_language_identifier.cc} +8 -0
- data/ext/cld3/{nnet_language_identifier.h → ext/src/nnet_language_identifier.h} +16 -0
- data/ext/cld3/{registry.cc → ext/src/registry.cc} +0 -0
- data/ext/cld3/{registry.h → ext/src/registry.h} +0 -0
- data/ext/cld3/{relevant_script_feature.cc → ext/src/relevant_script_feature.cc} +0 -0
- data/ext/cld3/{relevant_script_feature.h → ext/src/relevant_script_feature.h} +0 -0
- data/ext/cld3/ext/src/relevant_script_feature_test.cc +259 -0
- data/ext/cld3/{script_detector.h → ext/src/script_detector.h} +0 -0
- data/ext/cld3/ext/src/script_detector_test.cc +161 -0
- data/ext/cld3/ext/src/script_span/README.md +11 -0
- data/ext/cld3/{fixunicodevalue.cc → ext/src/script_span/fixunicodevalue.cc} +0 -0
- data/ext/cld3/{fixunicodevalue.h → ext/src/script_span/fixunicodevalue.h} +0 -0
- data/ext/cld3/{generated_entities.cc → ext/src/script_span/generated_entities.cc} +0 -0
- data/ext/cld3/{generated_ulscript.cc → ext/src/script_span/generated_ulscript.cc} +0 -0
- data/ext/cld3/{generated_ulscript.h → ext/src/script_span/generated_ulscript.h} +0 -0
- data/ext/cld3/{getonescriptspan.cc → ext/src/script_span/getonescriptspan.cc} +0 -0
- data/ext/cld3/{getonescriptspan.h → ext/src/script_span/getonescriptspan.h} +1 -1
- data/ext/cld3/ext/src/script_span/getonescriptspan_test.cc +135 -0
- data/ext/cld3/{integral_types.h → ext/src/script_span/integral_types.h} +0 -0
- data/ext/cld3/{offsetmap.cc → ext/src/script_span/offsetmap.cc} +0 -0
- data/ext/cld3/{offsetmap.h → ext/src/script_span/offsetmap.h} +0 -0
- data/ext/cld3/{port.h → ext/src/script_span/port.h} +0 -0
- data/ext/cld3/{stringpiece.h → ext/src/script_span/stringpiece.h} +0 -0
- data/ext/cld3/{text_processing.cc → ext/src/script_span/text_processing.cc} +0 -0
- data/ext/cld3/{text_processing.h → ext/src/script_span/text_processing.h} +0 -0
- data/ext/cld3/{utf8acceptinterchange.h → ext/src/script_span/utf8acceptinterchange.h} +0 -0
- data/ext/cld3/{utf8prop_lettermarkscriptnum.h → ext/src/script_span/utf8prop_lettermarkscriptnum.h} +0 -0
- data/ext/cld3/{utf8repl_lettermarklower.h → ext/src/script_span/utf8repl_lettermarklower.h} +0 -0
- data/ext/cld3/{utf8scannot_lettermarkspecial.h → ext/src/script_span/utf8scannot_lettermarkspecial.h} +0 -0
- data/ext/cld3/{utf8statetable.cc → ext/src/script_span/utf8statetable.cc} +0 -0
- data/ext/cld3/{utf8statetable.h → ext/src/script_span/utf8statetable.h} +0 -0
- data/ext/cld3/{sentence.proto → ext/src/sentence.proto} +0 -0
- data/ext/cld3/{sentence_features.cc → ext/src/sentence_features.cc} +0 -0
- data/ext/cld3/{sentence_features.h → ext/src/sentence_features.h} +0 -0
- data/ext/cld3/{simple_adder.h → ext/src/simple_adder.h} +0 -0
- data/ext/cld3/{task_context.cc → ext/src/task_context.cc} +0 -0
- data/ext/cld3/{task_context.h → ext/src/task_context.h} +0 -0
- data/ext/cld3/{task_context_params.cc → ext/src/task_context_params.cc} +0 -0
- data/ext/cld3/{task_context_params.h → ext/src/task_context_params.h} +0 -0
- data/ext/cld3/{task_spec.proto → ext/src/task_spec.proto} +0 -0
- data/ext/cld3/{unicodetext.cc → ext/src/unicodetext.cc} +0 -0
- data/ext/cld3/{unicodetext.h → ext/src/unicodetext.h} +0 -0
- data/ext/cld3/{utils.cc → ext/src/utils.cc} +0 -0
- data/ext/cld3/{utils.h → ext/src/utils.h} +0 -0
- data/ext/cld3/{workspace.cc → ext/src/workspace.cc} +0 -0
- data/ext/cld3/{workspace.h → ext/src/workspace.h} +0 -0
- metadata +87 -71
File without changes
|
@@ -0,0 +1,161 @@
|
|
1
|
+
/* Copyright 2016 Google Inc. All Rights Reserved.
|
2
|
+
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
14
|
+
==============================================================================*/
|
15
|
+
|
16
|
+
#include "script_detector.h"
|
17
|
+
|
18
|
+
#include <iostream>
|
19
|
+
|
20
|
+
#include "utils.h"
|
21
|
+
|
22
|
+
namespace chrome_lang_id {
|
23
|
+
namespace script_detector_test {
|
24
|
+
|
25
|
+
Script GetScript(const char *p) {
|
26
|
+
const int num_bytes = utils::OneCharLen(p);
|
27
|
+
return chrome_lang_id::GetScript(p, num_bytes);
|
28
|
+
}
|
29
|
+
|
30
|
+
bool PrintAndReturnStatus(bool status) {
|
31
|
+
if (status) {
|
32
|
+
std::cout << " Success" << std::endl;
|
33
|
+
return true;
|
34
|
+
} else {
|
35
|
+
std::cout << " Failure" << std::endl;
|
36
|
+
return false;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
bool TestGreekScript() {
|
41
|
+
std::cout << "Running " << __FUNCTION__ << std::endl;
|
42
|
+
|
43
|
+
// The first two conditions check first / last character from the Greek and
|
44
|
+
// Coptic script. The last two ones are negative tests.
|
45
|
+
return PrintAndReturnStatus(
|
46
|
+
kScriptGreek == GetScript("Ͱ") && kScriptGreek == GetScript("Ͽ") &&
|
47
|
+
kScriptGreek == GetScript("δ") && kScriptGreek == GetScript("Θ") &&
|
48
|
+
kScriptGreek == GetScript("Δ") && kScriptGreek != GetScript("a") &&
|
49
|
+
kScriptGreek != GetScript("0"));
|
50
|
+
}
|
51
|
+
|
52
|
+
bool TestCyrillicScript() {
|
53
|
+
std::cout << "Running " << __FUNCTION__ << std::endl;
|
54
|
+
return PrintAndReturnStatus(
|
55
|
+
kScriptCyrillic == GetScript("Ѐ") && kScriptCyrillic == GetScript("ӿ") &&
|
56
|
+
kScriptCyrillic == GetScript("ш") && kScriptCyrillic == GetScript("Б") &&
|
57
|
+
kScriptCyrillic == GetScript("Ӱ"));
|
58
|
+
}
|
59
|
+
|
60
|
+
bool TestHebrewScript() {
|
61
|
+
std::cout << "Running " << __FUNCTION__ << std::endl;
|
62
|
+
return PrintAndReturnStatus(
|
63
|
+
kScriptHebrew == GetScript("֑") && kScriptHebrew == GetScript("״") &&
|
64
|
+
kScriptHebrew == GetScript("ד") && kScriptHebrew == GetScript("ה") &&
|
65
|
+
kScriptHebrew == GetScript("צ"));
|
66
|
+
}
|
67
|
+
|
68
|
+
bool TestArabicScript() {
|
69
|
+
std::cout << "Running " << __FUNCTION__ << std::endl;
|
70
|
+
return PrintAndReturnStatus(kScriptArabic == GetScript("م") &&
|
71
|
+
kScriptArabic == GetScript("خ"));
|
72
|
+
}
|
73
|
+
|
74
|
+
bool TestHangulJamoScript() {
|
75
|
+
std::cout << "Running " << __FUNCTION__ << std::endl;
|
76
|
+
return PrintAndReturnStatus(kScriptHangulJamo == GetScript("ᄀ") &&
|
77
|
+
kScriptHangulJamo == GetScript("ᇿ") &&
|
78
|
+
kScriptHangulJamo == GetScript("ᄡ") &&
|
79
|
+
kScriptHangulJamo == GetScript("ᆅ") &&
|
80
|
+
kScriptHangulJamo == GetScript("ᅘ"));
|
81
|
+
}
|
82
|
+
|
83
|
+
bool TestHiraganaScript() {
|
84
|
+
std::cout << "Running " << __FUNCTION__ << std::endl;
|
85
|
+
return PrintAndReturnStatus(kScriptHiragana == GetScript("ぁ") &&
|
86
|
+
kScriptHiragana == GetScript("ゟ") &&
|
87
|
+
kScriptHiragana == GetScript("こ") &&
|
88
|
+
kScriptHiragana == GetScript("や") &&
|
89
|
+
kScriptHiragana == GetScript("ぜ"));
|
90
|
+
}
|
91
|
+
|
92
|
+
bool TestKatakanaScript() {
|
93
|
+
std::cout << "Running " << __FUNCTION__ << std::endl;
|
94
|
+
return PrintAndReturnStatus(kScriptKatakana == GetScript("゠") &&
|
95
|
+
kScriptKatakana == GetScript("ヿ") &&
|
96
|
+
kScriptKatakana == GetScript("ヂ") &&
|
97
|
+
kScriptKatakana == GetScript("ザ") &&
|
98
|
+
kScriptKatakana == GetScript("ヸ"));
|
99
|
+
}
|
100
|
+
|
101
|
+
bool TestOtherScripts() {
|
102
|
+
std::cout << "Running " << __FUNCTION__ << std::endl;
|
103
|
+
bool test_successful = true;
|
104
|
+
|
105
|
+
if (kScriptOtherUtf8OneByte != GetScript("^") ||
|
106
|
+
kScriptOtherUtf8OneByte != GetScript("$")) {
|
107
|
+
test_successful = false;
|
108
|
+
}
|
109
|
+
|
110
|
+
// Unrecognized 2-byte scripts. For info on the scripts mentioned below, see
|
111
|
+
// http://www.unicode.org/charts/#scripts Note: the scripts below are uniquely
|
112
|
+
// associated with a language. Still, the number of queries in those
|
113
|
+
// languages is small and we didn't want to increase the code size and
|
114
|
+
// latency, so (at least for now) we do not treat them specially.
|
115
|
+
// The following three tests are, respectively, for Armenian, Syriac and
|
116
|
+
// Thaana.
|
117
|
+
if (kScriptOtherUtf8TwoBytes != GetScript("Ձ") ||
|
118
|
+
kScriptOtherUtf8TwoBytes != GetScript("ܔ") ||
|
119
|
+
kScriptOtherUtf8TwoBytes != GetScript("ށ")) {
|
120
|
+
test_successful = false;
|
121
|
+
}
|
122
|
+
|
123
|
+
// Unrecognized 3-byte script: CJK Unified Ideographs: not uniquely associated
|
124
|
+
// with a language.
|
125
|
+
if (kScriptOtherUtf8ThreeBytes != GetScript("万") ||
|
126
|
+
kScriptOtherUtf8ThreeBytes != GetScript("両")) {
|
127
|
+
test_successful = false;
|
128
|
+
}
|
129
|
+
|
130
|
+
// Unrecognized 4-byte script: CJK Unified Ideographs Extension C. Note:
|
131
|
+
// there is a nice UTF-8 encoder / decoder at https://mothereff.in/utf-8
|
132
|
+
if (kScriptOtherUtf8FourBytes != GetScript("\xF0\xAA\x9C\x94")) {
|
133
|
+
test_successful = false;
|
134
|
+
}
|
135
|
+
|
136
|
+
// Unrecognized 4-byte script: CJK Unified Ideographs Extension E
|
137
|
+
if (kScriptOtherUtf8FourBytes != GetScript("\xF0\xAB\xA0\xB5") ||
|
138
|
+
kScriptOtherUtf8FourBytes != GetScript("\xF0\xAC\xBA\xA1")) {
|
139
|
+
test_successful = false;
|
140
|
+
}
|
141
|
+
|
142
|
+
return PrintAndReturnStatus(test_successful);
|
143
|
+
}
|
144
|
+
|
145
|
+
} // namespace script_detector_test
|
146
|
+
} // namespace chrome_lang_id
|
147
|
+
|
148
|
+
// Runs the feature extraction tests.
|
149
|
+
int main(int argc, char **argv) {
|
150
|
+
const bool tests_successful =
|
151
|
+
chrome_lang_id::script_detector_test::TestGreekScript() &&
|
152
|
+
chrome_lang_id::script_detector_test::TestCyrillicScript() &&
|
153
|
+
chrome_lang_id::script_detector_test::TestHebrewScript() &&
|
154
|
+
chrome_lang_id::script_detector_test::TestArabicScript() &&
|
155
|
+
chrome_lang_id::script_detector_test::TestHangulJamoScript() &&
|
156
|
+
chrome_lang_id::script_detector_test::TestHiraganaScript() &&
|
157
|
+
chrome_lang_id::script_detector_test::TestKatakanaScript() &&
|
158
|
+
chrome_lang_id::script_detector_test::TestOtherScripts();
|
159
|
+
|
160
|
+
return tests_successful ? 0 : 1;
|
161
|
+
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
The code in this directory identifies the scripts present in a given piece of
|
2
|
+
text along with the corresponding spans. The code was copied from
|
3
|
+
[CLD2](https://github.com/CLD2Owners/cld2) and was slightly refactored. It can
|
4
|
+
be further simplified and cleaned up.
|
5
|
+
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -93,7 +93,7 @@ class ScriptScanner {
|
|
93
93
|
// again with the first byte of the following range.
|
94
94
|
int MapBack(int text_offset);
|
95
95
|
|
96
|
-
const char* GetBufferStart() {return start_byte_;}
|
96
|
+
const char* GetBufferStart() {return start_byte_;}
|
97
97
|
|
98
98
|
private:
|
99
99
|
// Skip over tags and non-letters
|
@@ -0,0 +1,135 @@
|
|
1
|
+
/* Copyright 2016 Google Inc. All Rights Reserved.
|
2
|
+
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
14
|
+
==============================================================================*/
|
15
|
+
|
16
|
+
#include "getonescriptspan.h"
|
17
|
+
|
18
|
+
#include <iostream>
|
19
|
+
#include <vector>
|
20
|
+
|
21
|
+
namespace chrome_lang_id {
|
22
|
+
namespace CLD2 {
|
23
|
+
namespace getonescriptspan_test {
|
24
|
+
|
25
|
+
// Tests invalid and interchange-invalid input. Returns "true" if the test is
|
26
|
+
// successful and "false" otherwise.
|
27
|
+
bool TestInvalidUTF8Input() {
|
28
|
+
std::cout << "Running " << __FUNCTION__ << std::endl;
|
29
|
+
const std::vector<std::string> invalid_strings{"\xC0\xA9",
|
30
|
+
"\377\377\377\377"};
|
31
|
+
const std::string gold_valid_prefix = "Some valid bytes followed by ";
|
32
|
+
|
33
|
+
// Iterates over the invalid strings, inserts each of them in the middle of a
|
34
|
+
// piece of text, and checks whether these strings are correctly identified.
|
35
|
+
bool test_successful = true;
|
36
|
+
for (size_t i = 0; i < invalid_strings.size(); ++i) {
|
37
|
+
const std::string text = "Some valid bytes followed by " +
|
38
|
+
invalid_strings.at(i) +
|
39
|
+
" and then valid ones again.";
|
40
|
+
|
41
|
+
const int num_valid_bytes = SpanInterchangeValid(text.c_str(), text.size());
|
42
|
+
const std::string detected_valid_prefix(text.c_str(), num_valid_bytes);
|
43
|
+
std::cout << " Testing input string at position " << i << std::endl;
|
44
|
+
if (detected_valid_prefix == gold_valid_prefix) {
|
45
|
+
std::cout << " Success!" << std::endl;
|
46
|
+
} else {
|
47
|
+
std::cout << " Failure" << std::endl;
|
48
|
+
std::cout << " Gold: " << gold_valid_prefix << std::endl;
|
49
|
+
std::cout << " Detected: " << detected_valid_prefix << std::endl;
|
50
|
+
test_successful = false;
|
51
|
+
}
|
52
|
+
}
|
53
|
+
return test_successful;
|
54
|
+
}
|
55
|
+
|
56
|
+
// Tests whether different scripts are correctly detected. Returns "true" if the
|
57
|
+
// test is successful and "false" otherwise.
|
58
|
+
bool TestScriptDetection() {
|
59
|
+
std::cout << "Running " << __FUNCTION__ << std::endl;
|
60
|
+
|
61
|
+
// Text containing a snippet in English, a snippet in Bulgarian, and a snippet
|
62
|
+
// in English again.
|
63
|
+
const std::string text =
|
64
|
+
"Text in English. Текст на Български. Also text in English.";
|
65
|
+
const std::vector<std::string> gold_script_spans{
|
66
|
+
" Text in English ", " Текст на Български ", " Also text in English "};
|
67
|
+
|
68
|
+
std::vector<std::string> detected_script_spans;
|
69
|
+
ScriptScanner ss(text.c_str(), text.size(), /*is_plain_text=*/true);
|
70
|
+
LangSpan script_span;
|
71
|
+
while (ss.GetOneScriptSpan(&script_span)) {
|
72
|
+
detected_script_spans.emplace_back(script_span.text,
|
73
|
+
script_span.text_bytes);
|
74
|
+
}
|
75
|
+
|
76
|
+
if (detected_script_spans.size() != gold_script_spans.size()) {
|
77
|
+
std::cout << " Failure" << std::endl;
|
78
|
+
std::cout << " Number of gold spans " << gold_script_spans.size()
|
79
|
+
<< std::endl;
|
80
|
+
std::cout << " Number of detected spans " << detected_script_spans.size()
|
81
|
+
<< std::endl;
|
82
|
+
return false;
|
83
|
+
}
|
84
|
+
for (size_t i = 0; i < detected_script_spans.size(); ++i) {
|
85
|
+
if (detected_script_spans.at(i) != gold_script_spans.at(i)) {
|
86
|
+
std::cout << " Failure" << std::endl;
|
87
|
+
std::cout << " Gold span: " << gold_script_spans.at(i) << std::endl;
|
88
|
+
std::cout << " Detected span: " << detected_script_spans.at(i)
|
89
|
+
<< std::endl;
|
90
|
+
return false;
|
91
|
+
}
|
92
|
+
}
|
93
|
+
std::cout << " Success!" << std::endl;
|
94
|
+
return true;
|
95
|
+
}
|
96
|
+
|
97
|
+
// Tests the case when the input string is truncated in such a way that a
|
98
|
+
// character is split in two pieces. Returns "true" if the test is successful
|
99
|
+
// and "false" otherwise.
|
100
|
+
bool TestStringCut() {
|
101
|
+
std::cout << "Running " << __FUNCTION__ << std::endl;
|
102
|
+
|
103
|
+
// Text in Bulgarian (Cyrillic script).
|
104
|
+
const std::string text = "Текст на Български";
|
105
|
+
|
106
|
+
// The size of the first two words ("Текст на ") is 16, and size of the first
|
107
|
+
// two words plus the first char of the third word ("Текст на Б") is 18, so a
|
108
|
+
// threshold of 17 results in slicing the first char of the third word.
|
109
|
+
const int first_two_words_size = 16;
|
110
|
+
const int span_size = 17;
|
111
|
+
const int num_valid_bytes = SpanInterchangeValid(text.c_str(), span_size);
|
112
|
+
if (num_valid_bytes == first_two_words_size) {
|
113
|
+
std::cout << " Success!" << std::endl;
|
114
|
+
return true;
|
115
|
+
} else {
|
116
|
+
std::cout << " Failure" << std::endl;
|
117
|
+
std::cout << " Size of gold interchange-valid span: "
|
118
|
+
<< first_two_words_size << std::endl;
|
119
|
+
std::cout << " Size of detected span: " << num_valid_bytes << std::endl;
|
120
|
+
return false;
|
121
|
+
}
|
122
|
+
}
|
123
|
+
|
124
|
+
} // namespace getonescriptspan_test
|
125
|
+
} // namespace CLD2
|
126
|
+
} // namespace chrome_lang_id
|
127
|
+
|
128
|
+
// Runs the functions above.
|
129
|
+
int main(int argc, char **argv) {
|
130
|
+
const bool tests_successful =
|
131
|
+
chrome_lang_id::CLD2::getonescriptspan_test::TestInvalidUTF8Input() &&
|
132
|
+
chrome_lang_id::CLD2::getonescriptspan_test::TestScriptDetection() &&
|
133
|
+
chrome_lang_id::CLD2::getonescriptspan_test::TestStringCut();
|
134
|
+
return tests_successful ? 0 : 1;
|
135
|
+
}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/ext/cld3/{utf8prop_lettermarkscriptnum.h → ext/src/script_span/utf8prop_lettermarkscriptnum.h}
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cld3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.
|
4
|
+
version: 3.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Akihiko Odaki
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: 1.1.0
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 1.
|
22
|
+
version: 1.12.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: 1.1.0
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 1.
|
32
|
+
version: 1.12.0
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: rspec
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
version: 3.0.0
|
40
40
|
- - "<"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: 3.
|
42
|
+
version: 3.10.0
|
43
43
|
type: :development
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -49,7 +49,7 @@ dependencies:
|
|
49
49
|
version: 3.0.0
|
50
50
|
- - "<"
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version: 3.
|
52
|
+
version: 3.10.0
|
53
53
|
description: Compact Language Detector v3 (CLD3) is a neural network model for language
|
54
54
|
identification.
|
55
55
|
email: akihiko.odaki.4i@stu.hosei.ac.jp
|
@@ -60,73 +60,89 @@ extra_rdoc_files: []
|
|
60
60
|
files:
|
61
61
|
- Gemfile
|
62
62
|
- LICENSE
|
63
|
-
- LICENSE_CLD3
|
64
63
|
- README.md
|
65
64
|
- cld3.gemspec
|
66
|
-
- ext/cld3/
|
67
|
-
- ext/cld3/
|
68
|
-
- ext/cld3/
|
69
|
-
- ext/cld3/
|
70
|
-
- ext/cld3/
|
71
|
-
- ext/cld3/
|
72
|
-
- ext/cld3/
|
73
|
-
- ext/cld3/
|
65
|
+
- ext/cld3/ext/CMakeLists.txt
|
66
|
+
- ext/cld3/ext/CONTRIBUTING.md
|
67
|
+
- ext/cld3/ext/LICENSE
|
68
|
+
- ext/cld3/ext/README.md
|
69
|
+
- ext/cld3/ext/misc/myprotobuf.cmake
|
70
|
+
- ext/cld3/ext/model.png
|
71
|
+
- ext/cld3/ext/src/BUILD.gn
|
72
|
+
- ext/cld3/ext/src/DEPS
|
73
|
+
- ext/cld3/ext/src/base.cc
|
74
|
+
- ext/cld3/ext/src/base.h
|
75
|
+
- ext/cld3/ext/src/casts.h
|
76
|
+
- ext/cld3/ext/src/embedding_feature_extractor.cc
|
77
|
+
- ext/cld3/ext/src/embedding_feature_extractor.h
|
78
|
+
- ext/cld3/ext/src/embedding_network.cc
|
79
|
+
- ext/cld3/ext/src/embedding_network.h
|
80
|
+
- ext/cld3/ext/src/embedding_network_params.h
|
81
|
+
- ext/cld3/ext/src/feature_extractor.cc
|
82
|
+
- ext/cld3/ext/src/feature_extractor.h
|
83
|
+
- ext/cld3/ext/src/feature_extractor.proto
|
84
|
+
- ext/cld3/ext/src/feature_types.cc
|
85
|
+
- ext/cld3/ext/src/feature_types.h
|
86
|
+
- ext/cld3/ext/src/float16.h
|
87
|
+
- ext/cld3/ext/src/fml_parser.cc
|
88
|
+
- ext/cld3/ext/src/fml_parser.h
|
89
|
+
- ext/cld3/ext/src/lang_id_nn_params.cc
|
90
|
+
- ext/cld3/ext/src/lang_id_nn_params.h
|
91
|
+
- ext/cld3/ext/src/language_identifier_features.cc
|
92
|
+
- ext/cld3/ext/src/language_identifier_features.h
|
93
|
+
- ext/cld3/ext/src/language_identifier_features_test.cc
|
94
|
+
- ext/cld3/ext/src/language_identifier_main.cc
|
95
|
+
- ext/cld3/ext/src/nnet_lang_id_test.cc
|
96
|
+
- ext/cld3/ext/src/nnet_lang_id_test_data.cc
|
97
|
+
- ext/cld3/ext/src/nnet_lang_id_test_data.h
|
98
|
+
- ext/cld3/ext/src/nnet_language_identifier.cc
|
99
|
+
- ext/cld3/ext/src/nnet_language_identifier.h
|
100
|
+
- ext/cld3/ext/src/registry.cc
|
101
|
+
- ext/cld3/ext/src/registry.h
|
102
|
+
- ext/cld3/ext/src/relevant_script_feature.cc
|
103
|
+
- ext/cld3/ext/src/relevant_script_feature.h
|
104
|
+
- ext/cld3/ext/src/relevant_script_feature_test.cc
|
105
|
+
- ext/cld3/ext/src/script_detector.h
|
106
|
+
- ext/cld3/ext/src/script_detector_test.cc
|
107
|
+
- ext/cld3/ext/src/script_span/README.md
|
108
|
+
- ext/cld3/ext/src/script_span/fixunicodevalue.cc
|
109
|
+
- ext/cld3/ext/src/script_span/fixunicodevalue.h
|
110
|
+
- ext/cld3/ext/src/script_span/generated_entities.cc
|
111
|
+
- ext/cld3/ext/src/script_span/generated_ulscript.cc
|
112
|
+
- ext/cld3/ext/src/script_span/generated_ulscript.h
|
113
|
+
- ext/cld3/ext/src/script_span/getonescriptspan.cc
|
114
|
+
- ext/cld3/ext/src/script_span/getonescriptspan.h
|
115
|
+
- ext/cld3/ext/src/script_span/getonescriptspan_test.cc
|
116
|
+
- ext/cld3/ext/src/script_span/integral_types.h
|
117
|
+
- ext/cld3/ext/src/script_span/offsetmap.cc
|
118
|
+
- ext/cld3/ext/src/script_span/offsetmap.h
|
119
|
+
- ext/cld3/ext/src/script_span/port.h
|
120
|
+
- ext/cld3/ext/src/script_span/stringpiece.h
|
121
|
+
- ext/cld3/ext/src/script_span/text_processing.cc
|
122
|
+
- ext/cld3/ext/src/script_span/text_processing.h
|
123
|
+
- ext/cld3/ext/src/script_span/utf8acceptinterchange.h
|
124
|
+
- ext/cld3/ext/src/script_span/utf8prop_lettermarkscriptnum.h
|
125
|
+
- ext/cld3/ext/src/script_span/utf8repl_lettermarklower.h
|
126
|
+
- ext/cld3/ext/src/script_span/utf8scannot_lettermarkspecial.h
|
127
|
+
- ext/cld3/ext/src/script_span/utf8statetable.cc
|
128
|
+
- ext/cld3/ext/src/script_span/utf8statetable.h
|
129
|
+
- ext/cld3/ext/src/sentence.proto
|
130
|
+
- ext/cld3/ext/src/sentence_features.cc
|
131
|
+
- ext/cld3/ext/src/sentence_features.h
|
132
|
+
- ext/cld3/ext/src/simple_adder.h
|
133
|
+
- ext/cld3/ext/src/task_context.cc
|
134
|
+
- ext/cld3/ext/src/task_context.h
|
135
|
+
- ext/cld3/ext/src/task_context_params.cc
|
136
|
+
- ext/cld3/ext/src/task_context_params.h
|
137
|
+
- ext/cld3/ext/src/task_spec.proto
|
138
|
+
- ext/cld3/ext/src/unicodetext.cc
|
139
|
+
- ext/cld3/ext/src/unicodetext.h
|
140
|
+
- ext/cld3/ext/src/utils.cc
|
141
|
+
- ext/cld3/ext/src/utils.h
|
142
|
+
- ext/cld3/ext/src/workspace.cc
|
143
|
+
- ext/cld3/ext/src/workspace.h
|
74
144
|
- ext/cld3/extconf.rb
|
75
|
-
- ext/cld3/feature_extractor.cc
|
76
|
-
- ext/cld3/feature_extractor.h
|
77
|
-
- ext/cld3/feature_extractor.proto
|
78
|
-
- ext/cld3/feature_types.cc
|
79
|
-
- ext/cld3/feature_types.h
|
80
|
-
- ext/cld3/fixunicodevalue.cc
|
81
|
-
- ext/cld3/fixunicodevalue.h
|
82
|
-
- ext/cld3/float16.h
|
83
|
-
- ext/cld3/fml_parser.cc
|
84
|
-
- ext/cld3/fml_parser.h
|
85
|
-
- ext/cld3/generated_entities.cc
|
86
|
-
- ext/cld3/generated_ulscript.cc
|
87
|
-
- ext/cld3/generated_ulscript.h
|
88
|
-
- ext/cld3/getonescriptspan.cc
|
89
|
-
- ext/cld3/getonescriptspan.h
|
90
|
-
- ext/cld3/integral_types.h
|
91
|
-
- ext/cld3/lang_id_nn_params.cc
|
92
|
-
- ext/cld3/lang_id_nn_params.h
|
93
|
-
- ext/cld3/language_identifier_features.cc
|
94
|
-
- ext/cld3/language_identifier_features.h
|
95
|
-
- ext/cld3/nnet_language_identifier.cc
|
96
|
-
- ext/cld3/nnet_language_identifier.h
|
97
145
|
- ext/cld3/nnet_language_identifier_c.cc
|
98
|
-
- ext/cld3/offsetmap.cc
|
99
|
-
- ext/cld3/offsetmap.h
|
100
|
-
- ext/cld3/port.h
|
101
|
-
- ext/cld3/registry.cc
|
102
|
-
- ext/cld3/registry.h
|
103
|
-
- ext/cld3/relevant_script_feature.cc
|
104
|
-
- ext/cld3/relevant_script_feature.h
|
105
|
-
- ext/cld3/script_detector.h
|
106
|
-
- ext/cld3/sentence.proto
|
107
|
-
- ext/cld3/sentence_features.cc
|
108
|
-
- ext/cld3/sentence_features.h
|
109
|
-
- ext/cld3/simple_adder.h
|
110
|
-
- ext/cld3/stringpiece.h
|
111
|
-
- ext/cld3/task_context.cc
|
112
|
-
- ext/cld3/task_context.h
|
113
|
-
- ext/cld3/task_context_params.cc
|
114
|
-
- ext/cld3/task_context_params.h
|
115
|
-
- ext/cld3/task_spec.proto
|
116
|
-
- ext/cld3/text_processing.cc
|
117
|
-
- ext/cld3/text_processing.h
|
118
|
-
- ext/cld3/unicodetext.cc
|
119
|
-
- ext/cld3/unicodetext.h
|
120
|
-
- ext/cld3/utf8acceptinterchange.h
|
121
|
-
- ext/cld3/utf8prop_lettermarkscriptnum.h
|
122
|
-
- ext/cld3/utf8repl_lettermarklower.h
|
123
|
-
- ext/cld3/utf8scannot_lettermarkspecial.h
|
124
|
-
- ext/cld3/utf8statetable.cc
|
125
|
-
- ext/cld3/utf8statetable.h
|
126
|
-
- ext/cld3/utils.cc
|
127
|
-
- ext/cld3/utils.h
|
128
|
-
- ext/cld3/workspace.cc
|
129
|
-
- ext/cld3/workspace.h
|
130
146
|
- lib/cld3.rb
|
131
147
|
homepage: https://github.com/akihikodaki/cld3-ruby
|
132
148
|
licenses:
|
@@ -143,14 +159,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
143
159
|
version: 2.3.0
|
144
160
|
- - "<"
|
145
161
|
- !ruby/object:Gem::Version
|
146
|
-
version: 2.
|
162
|
+
version: 2.8.0
|
147
163
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
164
|
requirements:
|
149
165
|
- - ">="
|
150
166
|
- !ruby/object:Gem::Version
|
151
167
|
version: '0'
|
152
168
|
requirements: []
|
153
|
-
rubygems_version: 3.0.
|
169
|
+
rubygems_version: 3.0.6
|
154
170
|
signing_key:
|
155
171
|
specification_version: 4
|
156
172
|
summary: Compact Language Detector v3 (CLD3)
|