Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
3584aeec
M
models
项目概览
PaddlePaddle
/
models
大约 1 年 前同步成功
通知
222
Star
6828
Fork
2962
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
602
列表
看板
标记
里程碑
合并请求
255
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
models
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
602
Issue
602
列表
看板
标记
里程碑
合并请求
255
合并请求
255
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3584aeec
编写于
12月 04, 2019
作者:
王
王肖
提交者:
Xiaoyao Xi
12月 04, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix dgu text encoding(#4028)
上级
97b6d5cf
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
13 addition
and
11 deletion
+13
-11
PaddleNLP/PaddleDialogue/dialogue_general_understanding/dgu/reader.py
...ddleDialogue/dialogue_general_understanding/dgu/reader.py
+2
-0
PaddleNLP/PaddleDialogue/dialogue_general_understanding/dgu/scripts/build_atis_dataset.py
...e_general_understanding/dgu/scripts/build_atis_dataset.py
+4
-4
PaddleNLP/PaddleDialogue/dialogue_general_understanding/dgu/scripts/build_dstc2_dataset.py
..._general_understanding/dgu/scripts/build_dstc2_dataset.py
+3
-3
PaddleNLP/PaddleDialogue/dialogue_general_understanding/dgu/scripts/build_mrda_dataset.py
...e_general_understanding/dgu/scripts/build_mrda_dataset.py
+2
-2
PaddleNLP/PaddleDialogue/dialogue_general_understanding/dgu/scripts/build_swda_dataset.py
...e_general_understanding/dgu/scripts/build_swda_dataset.py
+2
-2
未找到文件。
PaddleNLP/PaddleDialogue/dialogue_general_understanding/dgu/reader.py
浏览文件 @
3584aeec
...
...
@@ -23,6 +23,8 @@ import numpy as np
from
dgu
import
tokenization
from
dgu.batching
import
prepare_batch_data
reload
(
sys
)
sys
.
setdefaultencoding
(
'utf-8'
)
class
DataProcessor
(
object
):
"""Base class for data converters for sequence classification data sets."""
...
...
PaddleNLP/PaddleDialogue/dialogue_general_understanding/dgu/scripts/build_atis_dataset.py
浏览文件 @
3584aeec
...
...
@@ -73,11 +73,11 @@ class ATIS(object):
if
example
[
1
]
not
in
self
.
intent_dict
:
self
.
intent_dict
[
example
[
1
]]
=
self
.
intent_id
self
.
intent_id
+=
1
fw
.
write
(
"%s
\t
%s
\n
"
%
(
self
.
intent_dict
[
example
[
1
]],
example
[
0
].
lower
()))
fw
.
write
(
u
"%s
\t
%s
\n
"
%
(
self
.
intent_dict
[
example
[
1
]],
example
[
0
].
lower
()))
fw
=
io
.
open
(
self
.
map_tag_intent
,
'w'
,
encoding
=
"utf8"
)
for
tag
in
self
.
intent_dict
:
fw
.
write
(
"%s
\t
%s
\n
"
%
(
tag
,
self
.
intent_dict
[
tag
]))
fw
.
write
(
u
"%s
\t
%s
\n
"
%
(
tag
,
self
.
intent_dict
[
tag
]))
def
_parser_slot_data
(
self
,
examples
,
data_type
):
"""
...
...
@@ -119,11 +119,11 @@ class ATIS(object):
if
entities
[
-
1
][
'end'
]
<
len
(
text
):
suffix_num
=
len
(
text
[
entities
[
-
1
][
'end'
]:].
strip
().
split
())
tags
.
extend
([
str
(
self
.
slot_dict
[
'O'
])]
*
suffix_num
)
fw
.
write
(
"%s
\t
%s
\n
"
%
(
text
.
encode
(
'utf8'
),
" "
.
join
(
tags
).
encode
(
'utf8'
)))
fw
.
write
(
u
"%s
\t
%s
\n
"
%
(
text
.
encode
(
'utf8'
),
" "
.
join
(
tags
).
encode
(
'utf8'
)))
fw
=
io
.
open
(
self
.
map_tag_slot
,
'w'
,
encoding
=
"utf8"
)
for
slot
in
self
.
slot_dict
:
fw
.
write
(
"%s
\t
%s
\n
"
%
(
slot
,
self
.
slot_dict
[
slot
]))
fw
.
write
(
u
"%s
\t
%s
\n
"
%
(
slot
,
self
.
slot_dict
[
slot
]))
def
get_train_dataset
(
self
):
"""
...
...
PaddleNLP/PaddleDialogue/dialogue_general_understanding/dgu/scripts/build_dstc2_dataset.py
浏览文件 @
3584aeec
...
...
@@ -106,8 +106,8 @@ class DSTC2(object):
out
=
"%s
\t
%s
\1
%s
\t
%s"
%
(
session_id
,
mach
,
user
,
labels_ids
)
user_asr
=
log_turn
[
'input'
][
'live'
][
'asr-hyps'
][
0
][
'asr-hyp'
].
strip
()
out_asr
=
"%s
\t
%s
\1
%s
\t
%s"
%
(
session_id
,
mach
,
user_asr
,
labels_ids
)
fw
.
write
(
"%s
\n
"
%
out
.
encode
(
'utf8'
))
fw_asr
.
write
(
"%s
\n
"
%
out_asr
.
encode
(
'utf8'
))
fw
.
write
(
u
"%s
\n
"
%
out
.
encode
(
'utf8'
))
fw_asr
.
write
(
u
"%s
\n
"
%
out_asr
.
encode
(
'utf8'
))
def
get_train_dataset
(
self
):
"""
...
...
@@ -133,7 +133,7 @@ class DSTC2(object):
"""
fw
=
io
.
open
(
self
.
map_tag
,
'w'
,
encoding
=
"utf8"
)
for
elem
in
self
.
map_tag_dict
:
fw
.
write
(
"%s
\t
%s
\n
"
%
(
elem
,
self
.
map_tag_dict
[
elem
]))
fw
.
write
(
u
"%s
\t
%s
\n
"
%
(
elem
,
self
.
map_tag_dict
[
elem
]))
def
main
(
self
):
"""
...
...
PaddleNLP/PaddleDialogue/dialogue_general_understanding/dgu/scripts/build_mrda_dataset.py
浏览文件 @
3584aeec
...
...
@@ -121,7 +121,7 @@ class MRDA(object):
caller
=
elem
.
split
(
'_'
)[
0
].
split
(
'-'
)[
-
1
]
conv_no
=
elem
.
split
(
'_'
)[
0
].
split
(
'-'
)[
0
]
out
=
"%s
\t
%s
\t
%s
\t
%s"
%
(
conv_no
,
self
.
map_tag_dict
[
tag
],
caller
,
v_trans
[
0
])
fw
.
write
(
"%s
\n
"
%
out
)
fw
.
write
(
u
"%s
\n
"
%
out
)
def
get_train_dataset
(
self
):
"""
...
...
@@ -147,7 +147,7 @@ class MRDA(object):
"""
fw
=
io
.
open
(
self
.
map_tag
,
'w'
,
encoding
=
"utf8"
)
for
elem
in
self
.
map_tag_dict
:
fw
.
write
(
"%s
\t
%s
\n
"
%
(
elem
,
self
.
map_tag_dict
[
elem
]))
fw
.
write
(
u
"%s
\t
%s
\n
"
%
(
elem
,
self
.
map_tag_dict
[
elem
]))
def
main
(
self
):
"""
...
...
PaddleNLP/PaddleDialogue/dialogue_general_understanding/dgu/scripts/build_swda_dataset.py
浏览文件 @
3584aeec
...
...
@@ -69,7 +69,7 @@ class SWDA(object):
idx
+=
1
continue
out
=
self
.
_parser_utterence
(
r
)
fw
.
write
(
"%s
\n
"
%
out
)
fw
.
write
(
u
"%s
\n
"
%
out
)
def
_clean_text
(
self
,
text
):
"""
...
...
@@ -213,7 +213,7 @@ class SWDA(object):
"""
fw
=
io
.
open
(
self
.
map_tag
,
'w'
,
encoding
=
'utf8'
)
for
elem
in
self
.
map_tag_dict
:
fw
.
write
(
"%s
\t
%s
\n
"
%
(
elem
,
self
.
map_tag_dict
[
elem
]))
fw
.
write
(
u
"%s
\t
%s
\n
"
%
(
elem
,
self
.
map_tag_dict
[
elem
]))
def
main
(
self
):
"""
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录