Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
kihoon.lee
dataset
Commits
8c65ecc4
Commit
8c65ecc4
authored
Aug 06, 2024
by
kihoon.lee
Browse files
update
parent
bf2b6eb0
Changes
1
Hide whitespace changes
Inline
Side-by-side
question_recommendation/run_labeling.py
View file @
8c65ecc4
...
@@ -48,6 +48,32 @@ def add_recommendation(input_file, output_file):
...
@@ -48,6 +48,32 @@ def add_recommendation(input_file, output_file):
with
open
(
output_file
,
'w'
,
encoding
=
'utf-8'
)
as
f
:
with
open
(
output_file
,
'w'
,
encoding
=
'utf-8'
)
as
f
:
json
.
dump
(
data
,
f
,
ensure_ascii
=
False
,
indent
=
4
)
json
.
dump
(
data
,
f
,
ensure_ascii
=
False
,
indent
=
4
)
def
concat_jsons
(
before_file_path
,
additional_file_path
,
after_file_path
):
with
open
(
before_file_path
,
'r'
,
encoding
=
'utf-8'
)
as
file_01
:
before_json
=
json
.
load
(
file_01
)
with
open
(
additional_file_path
,
'r'
,
encoding
=
'utf-8'
)
as
file_02
:
additional_json
=
json
.
load
(
file_02
)
for
item
in
tqdm
(
additional_json
):
new_entry
=
{
"질문"
:
item
.
get
(
"질문"
,
""
),
"답변"
:
item
.
get
(
"답변"
,
""
),
"추천질의"
:
item
.
get
(
"추천질의"
,
""
),
"그룹사"
:
None
,
"생성일"
:
None
,
"세션ID"
:
None
,
"모델타입"
:
None
,
"사용자 평가"
:
None
,
"모인ID"
:
None
}
before_json
.
append
(
new_entry
)
with
open
(
after_file_path
,
'w'
,
encoding
=
'utf-8'
)
as
file
:
json
.
dump
(
before_json
,
file
,
ensure_ascii
=
False
,
indent
=
4
)
def
testing
():
def
testing
():
question
=
"안녕"
question
=
"안녕"
...
@@ -58,10 +84,15 @@ def testing():
...
@@ -58,10 +84,15 @@ def testing():
return
None
return
None
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
testing
()
testing
()
add_recommendation
(
input_file
=
"QR_v1.45.json"
,
add_recommendation
(
input_file
=
"QR_v1.4a.json"
,
output_file
=
"QR_v1_46.json"
)
output_file
=
"QR_v1_4b.json"
)
concat_jsons
(
before_file_path
=
"QR_v1.4.json"
,
additional_file_path
=
"QR_v1.4b.json"
,
after_file_path
=
"QR_v1.5.json"
)
print
(
f
"
\033
[94m ##DONE##
\033
[0m"
)
print
(
f
"
\033
[94m ##DONE##
\033
[0m"
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment