Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
a7660331a
tesseract
提交
87707bb8
T
tesseract
项目概览
a7660331a
/
tesseract
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
tesseract
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
87707bb8
编写于
8月 06, 2021
作者:
S
Stefan Weil
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
unittest: Remove dependency on absl::StrSplit()
Signed-off-by:
N
Stefan Weil
<
sw@weilnetz.de
>
上级
f407345c
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
16 addition
and
22 deletion
+16
-22
Makefile.am
Makefile.am
+5
-6
unittest/fileio_test.cc
unittest/fileio_test.cc
+1
-3
unittest/mastertrainer_test.cc
unittest/mastertrainer_test.cc
+1
-3
unittest/paragraphs_test.cc
unittest/paragraphs_test.cc
+1
-3
unittest/stringrenderer_test.cc
unittest/stringrenderer_test.cc
+7
-4
unittest/unicharcompress_test.cc
unittest/unicharcompress_test.cc
+1
-3
未找到文件。
Makefile.am
浏览文件 @
87707bb8
...
...
@@ -1192,7 +1192,6 @@ libabseil_la_SOURCES += abseil/absl/strings/internal/str_format/output.cc
libabseil_la_SOURCES
+=
abseil/absl/strings/internal/str_format/parser.cc
libabseil_la_SOURCES
+=
abseil/absl/strings/match.cc
libabseil_la_SOURCES
+=
abseil/absl/strings/numbers.cc
libabseil_la_SOURCES
+=
abseil/absl/strings/str_split.cc
libabseil_la_SOURCES
+=
abseil/absl/strings/string_view.cc
libabseil_la_CPPFLAGS
=
-I
$(top_srcdir)
/abseil
...
...
@@ -1372,7 +1371,7 @@ endif # !DISABLED_LEGACY_ENGINE
fileio_test_SOURCES
=
unittest/fileio_test.cc
fileio_test_CPPFLAGS
=
$(unittest_CPPFLAGS)
fileio_test_LDADD
=
$(
ABSEIL_LIBS)
$(
TRAINING_LIBS)
fileio_test_LDADD
=
$(TRAINING_LIBS)
heap_test_SOURCES
=
unittest/heap_test.cc
heap_test_CPPFLAGS
=
$(unittest_CPPFLAGS)
...
...
@@ -1450,7 +1449,7 @@ lstmtrainer_test_LDADD = $(ABSEIL_LIBS) $(TRAINING_LIBS) $(LEPTONICA_LIBS)
if
!DISABLED_LEGACY_ENGINE
mastertrainer_test_SOURCES
=
unittest/mastertrainer_test.cc
mastertrainer_test_CPPFLAGS
=
$(unittest_CPPFLAGS)
mastertrainer_test_LDADD
=
$(
ABSEIL_LIBS)
$(
TRAINING_LIBS)
$(LEPTONICA_LIBS)
mastertrainer_test_LDADD
=
$(TRAINING_LIBS)
$(LEPTONICA_LIBS)
endif
# !DISABLED_LEGACY_ENGINE
matrix_test_SOURCES
=
unittest/matrix_test.cc
...
...
@@ -1497,7 +1496,7 @@ pango_font_info_test_LDADD += $(pangoft2_LIBS)
paragraphs_test_SOURCES
=
unittest/paragraphs_test.cc
paragraphs_test_CPPFLAGS
=
$(unittest_CPPFLAGS)
paragraphs_test_LDADD
=
$(
ABSEIL_LIBS)
$(
TESS_LIBS)
paragraphs_test_LDADD
=
$(TESS_LIBS)
if
!DISABLED_LEGACY_ENGINE
params_model_test_SOURCES
=
unittest/params_model_test.cc
...
...
@@ -1547,7 +1546,7 @@ stridemap_test_LDADD = $(TESS_LIBS)
stringrenderer_test_SOURCES
=
unittest/stringrenderer_test.cc
stringrenderer_test_CPPFLAGS
=
$(unittest_CPPFLAGS)
stringrenderer_test_LDADD
=
$(
ABSEIL_LIBS)
$(
TRAINING_LIBS)
$(LEPTONICA_LIBS)
stringrenderer_test_LDADD
=
$(TRAINING_LIBS)
$(LEPTONICA_LIBS)
stringrenderer_test_LDADD
+=
$(ICU_I18N_LIBS)
$(ICU_UC_LIBS)
stringrenderer_test_LDADD
+=
$(pangocairo_LIBS)
$(pangoft2_LIBS)
stringrenderer_test_LDADD
+=
$(cairo_LIBS)
$(pango_LIBS)
...
...
@@ -1587,7 +1586,7 @@ unichar_test_LDADD = $(TRAINING_LIBS) $(ICU_UC_LIBS)
unicharcompress_test_SOURCES
=
unittest/unicharcompress_test.cc
unicharcompress_test_CPPFLAGS
=
$(unittest_CPPFLAGS)
unicharcompress_test_LDADD
=
$(
ABSEIL_LIBS)
$(
TRAINING_LIBS)
$(ICU_UC_LIBS)
unicharcompress_test_LDADD
=
$(TRAINING_LIBS)
$(ICU_UC_LIBS)
unicharset_test_SOURCES
=
unittest/unicharset_test.cc
unicharset_test_CPPFLAGS
=
$(unittest_CPPFLAGS)
...
...
unittest/fileio_test.cc
浏览文件 @
87707bb8
...
...
@@ -12,8 +12,6 @@
#include <stdio.h>
#include <memory>
#include "absl/strings/str_split.h"
#include "fileio.h"
#include "include_gunit.h"
...
...
@@ -58,7 +56,7 @@ TEST(InputBufferTest, Read) {
std
::
string
str
;
auto
input
=
std
::
make_unique
<
InputBuffer
>
(
fp
);
EXPECT_TRUE
(
input
->
Read
(
&
str
));
std
::
vector
<
std
::
string
>
lines
=
absl
::
StrSplit
(
str
,
'\n'
,
absl
::
SkipEmpty
()
);
std
::
vector
<
std
::
string
>
lines
=
split
(
str
,
'\n'
);
EXPECT_EQ
(
2
,
lines
.
size
());
EXPECT_EQ
(
"Hello"
,
lines
[
0
]);
EXPECT_EQ
(
" world!"
,
lines
[
1
]);
...
...
unittest/mastertrainer_test.cc
浏览文件 @
87707bb8
...
...
@@ -32,8 +32,6 @@
#include "trainingsample.h"
#include "unicharset.h"
#include "absl/strings/str_split.h" // for absl::StrSplit
#include <string>
#include <utility>
#include <vector>
...
...
@@ -267,7 +265,7 @@ TEST_F(MasterTrainerTest, ErrorCounterTest) {
shape_classifier
.
get
(),
&
accuracy_report
);
LOG
(
INFO
)
<<
accuracy_report
.
c_str
();
std
::
string
result_string
=
accuracy_report
.
c_str
();
std
::
vector
<
std
::
string
>
results
=
absl
::
StrSplit
(
result_string
,
'\t'
,
absl
::
SkipEmpty
()
);
std
::
vector
<
std
::
string
>
results
=
split
(
result_string
,
'\t'
);
EXPECT_EQ
(
tesseract
::
CT_SIZE
+
1
,
results
.
size
());
int
result_values
[
tesseract
::
CT_SIZE
];
for
(
int
i
=
0
;
i
<
tesseract
::
CT_SIZE
;
++
i
)
{
...
...
unittest/paragraphs_test.cc
浏览文件 @
87707bb8
...
...
@@ -11,8 +11,6 @@
#include <string> // for std::string
#include "absl/strings/str_split.h" // for absl::StrSplit
#include "include_gunit.h" // for TEST
#include "log.h" // for LOG
...
...
@@ -60,7 +58,7 @@ void AsciiToRowInfo(const char *text, int row_number, RowInfo *info) {
info
->
lword_text
=
info
->
rword_text
=
""
;
info
->
ltr
=
true
;
std
::
vector
<
std
::
string
>
words
=
absl
::
StrSplit
(
text
,
' '
,
absl
::
SkipEmpty
()
);
std
::
vector
<
std
::
string
>
words
=
split
(
text
,
' '
);
info
->
num_words
=
words
.
size
();
if
(
info
->
num_words
<
1
)
{
return
;
...
...
unittest/stringrenderer_test.cc
浏览文件 @
87707bb8
...
...
@@ -17,7 +17,6 @@
#include "stringrenderer.h"
#include <allheaders.h>
#include "absl/strings/str_split.h" // for absl::StrSplit
#include <memory>
#include <string>
...
...
@@ -348,7 +347,7 @@ TEST_F(StringRendererTest, DoesRenderWordBoxes) {
EXPECT_EQ
(
strlen
(
kEngText
),
renderer_
->
RenderToImage
(
kEngText
,
strlen
(
kEngText
),
&
pix
));
pix
.
destroy
();
// Verify #boxchars = #words + #spaces
std
::
vector
<
std
::
string
>
words
=
absl
::
StrSplit
(
kEngText
,
' '
,
absl
::
SkipEmpty
()
);
std
::
vector
<
std
::
string
>
words
=
split
(
kEngText
,
' '
);
const
int
kNumSpaces
=
words
.
size
()
-
1
;
const
int
kExpectedNumBoxes
=
words
.
size
()
+
kNumSpaces
;
const
std
::
vector
<
BoxChar
*>
&
boxchars
=
renderer_
->
GetBoxes
();
...
...
@@ -371,8 +370,12 @@ TEST_F(StringRendererTest, DoesRenderWordBoxesFromMultiLineText) {
EXPECT_EQ
(
strlen
(
kMultlineText
),
renderer_
->
RenderToImage
(
kMultlineText
,
strlen
(
kEngText
),
&
pix
));
pix
.
destroy
();
// Verify #boxchars = #words + #spaces + #newlines
std
::
vector
<
std
::
string
>
words
=
absl
::
StrSplit
(
kMultlineText
,
absl
::
ByAnyChar
(
"
\n
"
),
absl
::
SkipEmpty
());
std
::
vector
<
std
::
string
>
words
;
for
(
auto
&
line
:
split
(
kMultlineText
,
'\n'
))
{
for
(
auto
&
word
:
split
(
line
,
' '
))
{
words
.
push_back
(
word
);
}
}
const
int
kNumSeparators
=
words
.
size
()
-
1
;
const
int
kExpectedNumBoxes
=
words
.
size
()
+
kNumSeparators
;
const
std
::
vector
<
BoxChar
*>
&
boxchars
=
renderer_
->
GetBoxes
();
...
...
unittest/unicharcompress_test.cc
浏览文件 @
87707bb8
...
...
@@ -12,8 +12,6 @@
#include <string>
#include <allheaders.h>
#include "absl/strings/ascii.h"
#include "absl/strings/str_split.h"
#include "include_gunit.h"
#include "log.h" // for LOG
...
...
@@ -232,7 +230,7 @@ TEST_F(UnicharcompressTest, GetEncodingAsString) {
ExpectCorrect
(
"trivial"
);
std
::
string
encoding
=
compressed_
.
GetEncodingAsString
(
unicharset_
);
std
::
string
encoding_str
(
&
encoding
[
0
],
encoding
.
length
());
std
::
vector
<
std
::
string
>
lines
=
absl
::
StrSplit
(
encoding_str
,
"
\n
"
,
absl
::
SkipEmpty
()
);
std
::
vector
<
std
::
string
>
lines
=
split
(
encoding_str
,
'\n'
);
EXPECT_EQ
(
5
,
lines
.
size
());
// The first line is always space.
EXPECT_EQ
(
"0
\t
"
,
lines
[
0
]);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录