Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
xuning
/
sherpaonnx
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Fangjun Kuang
2023-10-26 13:07:30 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
GitHub
2023-10-26 13:07:30 +0800
Commit
a8fed2a9ce76d21aa2c15fab19deee998a5cb2b8
a8fed2a9
1 parent
fcde4c49
Fix splitting words containing ', e.g., I've (#389)
隐藏空白字符变更
内嵌
并排对比
正在显示
1 个修改的文件
包含
3 行增加
和
1 行删除
sherpa-onnx/csrc/text-utils.cc
sherpa-onnx/csrc/text-utils.cc
查看文件 @
a8fed2a
...
...
@@ -163,6 +163,8 @@ template bool SplitStringToFloats(const std::string &full, const char *delim,
bool
omit_empty_strings
,
std
::
vector
<
double
>
*
out
);
static
bool
IsPunct
(
char
c
)
{
return
c
!=
'\''
&&
std
::
ispunct
(
c
);
}
static
std
::
vector
<
std
::
string
>
MergeCharactersIntoWords
(
const
std
::
vector
<
std
::
string
>
&
words
)
{
std
::
vector
<
std
::
string
>
ans
;
...
...
@@ -174,7 +176,7 @@ static std::vector<std::string> MergeCharactersIntoWords(
while
(
i
<
n
)
{
const
auto
&
w
=
words
[
i
];
if
(
w
.
size
()
>
1
||
(
w
.
size
()
==
1
&&
(
std
::
isp
unct
(
w
[
0
])
||
std
::
isspace
(
w
[
0
]))))
{
(
w
.
size
()
==
1
&&
(
IsP
unct
(
w
[
0
])
||
std
::
isspace
(
w
[
0
]))))
{
if
(
prev
!=
-
1
)
{
std
::
string
t
;
for
(;
prev
<
i
;
++
prev
)
{
...
...
请
注册
或
登录
后发表评论