/Q-A-Movie-System

研一人工智能原理大作业:基于垂直领域的电影查询问答系统,采用Neo4j、jieba分词和朴素贝叶斯分类算法实现

Primary LanguagePython

基于垂直领域的电影查询问答系统

1、安装neo4j

2、将数据集放入安装包的import目录

3、命令行输入neo4j start 启动数据库

4、打开http://localhost:7474,设置密码为123456

5、执行以下代码导入数据集

//导入节点 电影类型 == 注意类型转换 LOAD CSV WITH HEADERS FROM "file:///genre.csv" AS line MERGE (p:Genre{gid:toInteger(line.gid),name:line.gname})

//导入节点 演员信息 LOAD CSV WITH HEADERS FROM 'file:///person.csv' AS line MERGE (p:Person { pid:toInteger(line.pid),birth:line.birth, death:line.death,name:line.name, biography:line.biography, birthplace:line.birthplace})

// 导入节点 电影信息 LOAD CSV WITH HEADERS FROM "file:///movie.csv" AS line
MERGE (p:Movie{mid:toInteger(line.mid),title:line.title,introduction:line.introduction, rating:toFloat(line.rating),releasedate:line.releasedate})

// 导入关系 actedin 电影是谁参演的 1对多 LOAD CSV WITH HEADERS FROM "file:///person_to_movie.csv" AS line match (from:Person{pid:toInteger(line.pid)}),(to:Movie{mid:toInteger(line.mid)})
merge (from)-[r:actedin{pid:toInteger(line.pid),mid:toInteger(line.mid)}]->(to)

//导入关系 电影是什么类型 == 1对多 LOAD CSV WITH HEADERS FROM "file:///movie_to_genre.csv" AS line match (from:Movie{mid:toInteger(line.mid)}),(to:Genre{gid:toInteger(line.gid)})
merge (from)-[r:is{mid:toInteger(line.mid),gid:toInteger(line.gid)}]->(to)

6、在python IDE中运行代码