医疗知识图谱项目调试

第一步:安装该项目运行所需的环境,建议对每一个项目都新建一个conda环境,方便使用。conda环境配置自行搜索。

以下是项目运行所需包,不要直接安装,可以跟着我的测试步骤,缺包时再进行安装。

absl-py                        1.3.0
appdirs                        1.4.4
asgiref                        3.6.0
astor                          0.8.1
async-timeout                  4.0.2
attr                           0.3.1
attrs                          22.2.0
azure-core                     1.26.2
azure-storage-blob             12.14.1
boto                           2.49.0
boto3                          1.16.63
botocore                       1.19.63
boxing                         0.1.4
cachetools                     5.3.0
certifi                        2022.12.7
cffi                           1.15.1
charset-normalizer             2.0.12
Click                          7.0
colorama                       0.4.6
coreapi                        2.3.3
coreschema                     0.0.4
cryptography                   39.0.0
Cython                         0.29.33
defusedxml                     0.7.1
Django                         3.2.14
django-annoying                0.10.6
django-cors-headers            3.6.0
django-debug-toolbar           3.2.1
django-extensions              3.1.0
django-filter                  2.4.0
django-model-utils             4.1.1
django-ranged-fileresponse     0.1.2
django-rest-swagger            2.2.0
django-rq                      2.5.1
django-user-agents             0.4.0
djangorestframework            3.13.1
dnspython                      2.3.0
drf-dynamic-fields             0.3.0
drf-flex-fields                0.9.5
drf-generators                 0.3.0
drf-yasg                       1.20.0
expiringdict                   1.1.4
flit_core                      3.6.0
gast                           0.5.3
google-api-core                2.10.0
google-auth                    2.11.0
google-cloud-appengine-logging 1.1.0
google-cloud-audit-log         0.2.0
google-cloud-core              2.3.2
google-cloud-logging           2.7.2
google-cloud-storage           2.5.0
google-crc32c                  1.5.0
google-pasta                   0.2.0
google-resumable-media         2.3.3
googleapis-common-protos       1.56.4
grpc-google-iam-v1             0.12.3
grpcio                         1.51.1
grpcio-status                  1.48.2
h5py                           3.7.0
htmlmin                        0.1.12
idna                           3.4
importlib-metadata             4.11.3
inflection                     0.5.1
isodate                        0.6.1
itypes                         1.2.0
jieba                          0.42.1
Jinja2                         3.1.2
jmespath                       0.10.0
joblib                         1.2.0
jsonschema                     3.2.0
Keras-Applications             1.0.8
Keras-Preprocessing            1.1.2
label-studio                   1.6.0
label-studio-converter         0.0.44
label-studio-tools             0.0.1
launchdarkly-server-sdk        7.3.0
lockfile                       0.12.2
lxml                           4.9.2
Markdown                       3.4.1
MarkupSafe                     2.1.1
mkl-fft                        1.0.14
mkl-random                     1.0.4
mkl-service                    2.3.0
msrest                         0.7.1
neo4j-driver                   5.5.0
neobolt                        1.7.17
neotime                        1.7.4
nltk                           3.6.7
numpy                          1.21.6
oauthlib                       3.2.2
openapi-codec                  1.3.2
ordered-set                    4.0.2
packaging                      23.0
pandas                         1.3.5
Pillow                         9.0.1
pinyin                         0.4.0
pip                            23.0
prompt-toolkit                 2.0.10
proto-plus                     1.22.2
protobuf                       3.20.3
psycopg2-binary                2.9.1
py2neo                         4.3.0
pyahocorasick                  2.0.0
pyasn1                         0.4.8
pyasn1-modules                 0.2.8
pycparser                      2.21
pydantic                       1.8.2
Pygments                       2.3.1
pymongo                        4.3.3
pyRFC3339                      1.1
pyrsistent                     0.19.3
pytest-runner                  6.0.0
python-dateutil                2.8.1
python-json-logger             2.0.4
pytz                           2019.3
PyYAML                         6.0
redis                          4.4.2
regex                          2022.10.31
requests                       2.27.1
requests-oauthlib              1.3.1
rq                             1.10.1
rsa                            4.9
ruamel.yaml                    0.17.21
ruamel.yaml.clib               0.2.7
rules                          2.2
s3transfer                     0.3.7
scikit-learn                   1.0.2
scipy                          1.6.2
semver                         2.13.0
sentry-sdk                     1.14.0
setuptools                     67.1.0
simplejson                     3.18.1
six                            1.16.0
sqlparse                       0.4.3
tensorboard                    1.14.0
tensorflow                     1.14.0
tensorflow-estimator           1.14.0
termcolor                      2.1.0
threadpoolctl                  3.1.0
thulac                         0.2.2
tqdm                           4.64.1
typing_extensions              4.4.0
ua-parser                      0.16.1
ujson                          5.7.0
uritemplate                    4.1.1
urllib3                        1.24.3
user-agents                    2.2.0
wcwidth                        0.2.6
Werkzeug                       2.2.2
wheel                          0.38.4
wrapt                          1.14.1
xmljson                        0.2.0
zipp                           3.11.0
1、配置要求:要求配置neo4j数据库及相应的python依赖包。neo4j数据库用户名密码记住,并修改相应文件。 没有neo4j可以翻看我之前的文档,有关于neo4j的安装和使用。

2、知识图谱数据导入:运行 build_medicalgraph.py,导入的数据较多,估计需要几个小时。代码有需要修改的地方。请把user和password修改成自己的。

class MedicalGraph:
    def __init__(self):
        cur_dir = '/'.join(os.path.abspath(__file__).split('/')[:-1])
        self.data_path = os.path.join(cur_dir, 'data/medical.json')
        self.g = Graph(
            host="127.0.0.1",  # neo4j 搭载服务器的ip地址,ifconfig可获取到
            http_port=7474,  # neo4j 服务器监听的端口号
            user="neo4j",  # 数据库user name,如果没有更改过,应该是neo4j
            password="12345678")

3、之后还有一个地方需要修改,question_classifier.py请修改该段代码,加上utf-8,如下。

 # 加载特征词
        self.disease_wds= [i.strip() for i in open(self.disease_path,encoding='utf-8') if i.strip()]
        self.department_wds= [i.strip() for i in open(self.department_path,encoding='utf-8') if i.strip()]
        self.check_wds= [i.strip() for i in open(self.check_path,encoding='utf-8') if i.strip()]
        self.drug_wds= [i.strip() for i in open(self.drug_path,encoding='utf-8') if i.strip()]
        self.food_wds= [i.strip() for i in open(self.food_path,encoding='utf-8') if i.strip()]
        self.producer_wds= [i.strip() for i in open(self.producer_path,encoding='utf-8') if i.strip()]
        self.symptom_wds= [i.strip() for i in open(self.symptom_path,encoding='utf-8') if i.strip()]
        self.region_words = set(self.department_wds + self.disease_wds + self.check_wds + self.drug_wds + self.food_wds + self.producer_wds + self.symptom_wds)
        self.deny_words = [i.strip() for i in open(self.deny_path,encoding='utf-8') if i.strip()]
4、最后还有一个地方需要修改,answer_search.py请修改该段代码,如下。请把user和password修改成自己的。
class AnswerSearcher:
    def __init__(self):
        self.g = Graph(
            host="127.0.0.1",
            http_port=7474,
            user="neo4j",
            password="12345678")
        self.num_limit = 20

这样代码应该就可以跑通了,关于代码内容,简述:data里的文件是爬虫的json文件,dictl里的文件是节点,其余的可以参考readme.md,有关代码调试问题可以加我qq:761106801。

侵权问题可联系我删除。以上!

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值