yongzhuo / nlg-yongzhuo

中文文本生成(NLG)之文本摘要(text summarization)工具包, 语料数据(corpus data), 抽取式摘要 Extractive text summary of Lead3、keyword、textrank、text teaser、word significance、LDA、LSI、NMF。(graph,feature,topic model,summarize tool or tookit)
https://blog.csdn.net/rensihui
MIT License
405 stars 53 forks source link

pip 安装的问题 #14

Closed FengMu1995 closed 8 months ago

FengMu1995 commented 8 months ago

thank you for your contribution ubuntu18.04试过python3.7 3.8,安装会出现问题,同https://github.com/yongzhuo/nlg-yongzhuo/issues/13 python3.6 bug如下:

File "/home/xxx/Software/yes/envs/nlg/lib/python3.6/site-packages/smart_open/s3.py", line 9 from future import annotations ^ SyntaxError: future feature annotations is not defined

yongzhuo commented 8 months ago

盲猜是scikit-learn,scipy,numpy,pandas的包冲突了 1.先不要依赖安装

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple nlg-yongzhuo --no-dependencies

2.然后跑该包的时候,你看看缺什么再按照下面的版本安装包

scikit-learn==0.19.1
textrank4zh==0.3
pandas==0.23.4
passlib==1.7.1
numpy==1.16.2
gensim==3.7.1
tqdm==4.31.1
jieba==0.39

3.操作日志

(py37) $ pip install -i https://pypi.tuna.tsinghua.edu.cn/simple nlg-yongzhuo --no-dependencies
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting nlg-yongzhuo
  Using cached yongzhuo-0.0.4-py2.py3-none-any.whl (74 kB)
Installing collected packages: nlg-yongzhuo
Successfully installed nlg-yongzhuo-0.0.4
(py37)$ python tet_feature_base.py
Traceback (most recent call last):
  File "tet_feature_base.py", line 8, in <module>
    from nlg_yongzhuo import word_significance
  File "/anaconda3/envs/py37/lib/python3.7/site-packages/nlg_yongzhuo/__init__.py", line 13, in <module>
    from nlg_yongzhuo.text_summarization.extractive_sum.graph_base.textrank.textrank import TextRankSum
  File "/anaconda3/envs/py37/lib/python3.7/site-packages/nlg_yongzhuo/text_summarization/extractive_sum/graph_base/textrank/textrank.py", line 12, in <module>
    from textrank4zh import TextRank4Sentence
ModuleNotFoundError: No module named 'textrank4zh'
(py37)$ pip install -i https://pypi.tuna.tsinghua.edu.cn/simple textrank4zh
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting textrank4zh
  Using cached /textrank4zh-0.3.zip (13 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: jieba>=0.35 in /anaconda3/envs/py37/lib/python3.7/site-packages (from textrank4zh) (0.39)
Requirement already satisfied: numpy>=1.7.1 in /anaconda3/envs/py37/lib/python3.7/site-packages (from textrank4zh) (1.21.6)
Requirement already satisfied: networkx>=1.9.1 in /anaconda3/envs/py37/lib/python3.7/site-packages (from textrank4zh) (2.4)
Requirement already satisfied: decorator>=4.3.0 in /anaconda3/envs/py37/lib/python3.7/site-packages (from networkx>=1.9.1->textrank4zh) (5.1.1)
Building wheels for collected packages: textrank4zh
  Building wheel for textrank4zh (setup.py) ... done
  Created wheel for textrank4zh: filename=textrank4zh-0.3-py3-none-any.whl size=13422
  Stored in directory: .cache/pip/wheels/af/
Successfully built textrank4zh
Installing collected packages: textrank4zh
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
nlg-yongzhuo 0.0.4 requires numpy==1.16.2, but you have numpy 1.21.6 which is incompatible.
nlg-yongzhuo 0.0.4 requires pandas==0.23.4, but you have pandas 1.3.5 which is incompatible.
nlg-yongzhuo 0.0.4 requires scikit-learn==0.19.1, but you have scikit-learn 1.0.2 which is incompatible.
nlg-yongzhuo 0.0.4 requires tqdm==4.31.1, but you have tqdm 4.64.1 which is incompatible.
Successfully installed textrank4zh-0.3
(py37) $ python tet_feature_base.py
word_significance:
(0.9878048780487805, ' 被告人曾榴仙,女,1954年11月22日出生于江西省上饶市信州区,汉族,文盲,无业,家住上饶市信州区,因涉嫌过失致人死亡罪,2016年4月27日被上饶市公安局信州区分局刑事拘留,2016年6月1日被执行逮捕')
(0.9878048780487805, ' 上饶市信州区人民检察院以饶信检公诉刑诉[2016]260号起诉书指控被告人曾榴仙犯过失致人死亡罪,于2016年8月22日向本院提起公诉')
(0.9878048780487805, '上饶市信州区人民检察院指派检察员苏雪莉出庭支持公诉,被告人曾榴仙及辩护人毛巧云,到庭参加诉讼')
(0.9878048780487805, ' 被告人曾榴仙与被害人祝某两家系位于信州区沙溪镇向阳村柘阳的多年邻居,被害人祝某有多年心脏病史,被告人曾榴仙对此事明知')
(0.9878048780487805, '2016年4月27日7时许,被告人曾榴仙的丈夫徐某1在修理两家相邻路埂时因权属问题遭到对方阻拦,被告人曾榴仙和其丈夫徐某1分别与被害人祝某及其丈夫徐某2发生争吵、拉扯,被告人曾榴仙与被害人祝某拉扯至祝某家的厕所边,后被害人祝某心脏病发作倒地,在送往医院途中死亡')
(0.9878048780487805, ' 2016年4月27日,被告人曾榴仙得知祝某死亡的消息后,在其丈夫徐某1的陪同下到沙溪派出所投案自首')
text_pronouns:
(11.790215384615385, '1、被告人曾榴仙是否知道祝某有心脏病')
(10.784932330827067, '被告人曾榴仙家属赔偿了被害人祝某家属的损失,并取得了谅解,被告人曾榴仙具备酌情从轻处罚情节')
(10.783565079365081, '被告人曾榴仙与被害人祝某两家系位于信州区沙溪镇向阳村柘阳的多年邻居,被害人祝某有多年心脏病史,被告人曾榴仙对此事明知')
(9.72666928104575, '被告人曾榴仙犯过失致人死亡罪,判处有期徒刑一年,缓刑一年')
(9.479660317460318, '本案在审理过程中,被告人曾榴仙家属赔偿了被害人祝某家属的损失,并取得了谅解')
(9.421468131868133, '同时认为被告人曾榴仙具有如下量刑情节')
text_teaser:
(0.19828821745956735, '1、被告人曾榴仙是否知道祝某有心脏病')
(0.18326246732644252, '同时认为被告人曾榴仙具有如下量刑情节')
(0.16207528052757564, '其行为已触犯刑法,构成过失致人死亡罪')
(0.16085660411407413, '公诉机关指控的罪名成立,本院予以支持')
(0.15999905031911063, '被告人曾榴仙对起诉书指控的犯罪事实不持异议')
(0.15664034642040875, '书面上诉的,应当提交上诉状正本一份,副本二份')
mmr:
(4.444260393770881, '经江西上饶司法鉴定中心鉴定,被害人祝某额部及全身多处皮肤因外力作用致软组织挫擦伤,生前患有心肌肥大,心瓣膜病等器质性疾病导致心源性猝死是主因,本次与他人发生争吵、拉扯系导致心源性猝死的诱因')
(4.437666425566239, '2016年4月27日7时许,被告人曾榴仙的丈夫徐某1在修理两家相邻路埂时因权属问题遭到对方阻拦,被告人曾榴仙和其丈夫徐某1分别与被害人祝某及其丈夫徐某2发生争吵、拉扯,被告人曾榴仙与被害人祝某拉扯至祝某家的厕所边,后被害人祝某心脏病发作倒地,在送往医院途中死亡')
(4.434316628788284, ' 审判长程明 人民陪审员钱进 人民陪审员郑艳 二〇一六年十一月十四日 书记员郭建锋 江西省上饶市信州区人民法院 刑事判决书 (2016)赣1102刑初274号 公诉机关上饶市信州区人民检察院')
(4.281162630531027, ' 上述事实,被告人曾榴仙在开庭审理过程中亦无异议,且有被告人曾榴仙的常住人口信息,归案情况说明,证人徐某1、冯某、徐某3、徐某2、黄某、郑某的证言,被告曾榴仙的供述及辨认笔录,鉴定意见,现场勘查笔录等证据证实,足以认定')
(3.873490470939821, ' 被告人曾榴仙,女,1954年11月22日出生于江西省上饶市信州区,汉族,文盲,无业,家住上饶市信州区,因涉嫌过失致人死亡罪,2016年4月27日被上饶市公安局信州区分局刑事拘留,2016年6月1日被执行逮捕')
(3.6422670884382105, ' 本院认为,被告人曾榴仙明知被害人祝某有心脏病,应当预见其行为可能导致祝某病发死亡的后果,因轻信能够避免而与被害人祝某发生争吵和拉扯,导致被害人病发死亡')
FengMu1995 commented 8 months ago

好的,谢谢大佬. 在这里注上我的解决方法,python3.6 smart_open版本用6.0.0,不要用7.0.0不会报问题了