Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
text-classification-cnn
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhou
text-classification-cnn
Commits
2e623632
Commit
2e623632
authored
Apr 02, 2020
by
Zhouxingyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改了一些提示和内存释放
parent
aef84656
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
4 deletions
+8
-4
checkpoints.rar
checkpoints.rar
+0
-0
run_cnn.py
run_cnn.py
+3
-1
示例.py
示例.py
+5
-3
No files found.
checkpoints.rar
0 → 100644
View file @
2e623632
File added
run_cnn.py
View file @
2e623632
...
...
@@ -17,6 +17,8 @@ from data.cnews_loader import read_vocab, read_category, batch_iter, process_fil
import
pandas
as
pd
from
function
import
Index
os
.
environ
[
'TF_CPP_MIN_LOG_LEVEL'
]
=
'2'
base_dir
=
'data/name2category'
train_dir
=
os
.
path
.
join
(
base_dir
,
'name2category.train.txt'
)
test_dir
=
os
.
path
.
join
(
base_dir
,
'name2category.test.txt'
)
...
...
@@ -202,7 +204,7 @@ class name2subcategory():
def
namelyst_predict
(
self
,
contents
):
from
tensorflow
import
keras
as
kr
print
(
"Loading predicted data..."
)
#
print("Loading predicted data...")
data_id
=
[]
for
i
in
range
(
len
(
contents
)):
data_id
.
append
([
self
.
word_to_id
[
x
]
for
x
in
contents
[
i
]
if
x
in
self
.
word_to_id
])
...
...
示例.py
View file @
2e623632
from
run_cnn
import
name2subcategory
name_list
=
[
'安赛瑞 消防斧 应急斧头破拆斧工具 消防器材斧子消防站配置 消防检查斧子 25847'
]
a
=
name2subcategory
()
category
=
a
.
namelyst_predict
(
name_list
)
\ No newline at end of file
while
True
:
name
=
input
(
'请输入产品名称:'
)
name_list
=
[
name
]
category
=
a
.
namelyst_predict
(
name_list
)
print
(
category
[
0
])
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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