PyABSA
Release two more ABSA subtasks
你好呀!如果對您有所幫助,請播放此存儲庫!每個星星都可以幫助Pyabsa走得更遠,非常感謝。 Pyabsa是每個人的免費和開源工具,但請不要忘記在您的作品,產品和出版物等中附加(非正式或正式的)作者信息和項目地址。
除紙外,pyabsa中還有兩個新功能:方面情感三重態提取和方面四倍提取。我們已將演示部署在HuggingFace空間上,您可以在線嘗試。
我們為不同任務準備了許多示例。請參閱示例以獲取更多用法示例。
要使用PYABSA,請從PIP或源代碼中安裝最新版本:
pip install -U pyabsagit clone https://github.com/yangheng95/PyABSA --depth=1
cd PyABSA
python setup.py install from pyabsa import AspectTermExtraction as ATEPC , available_checkpoints
# you can view all available checkpoints by calling available_checkpoints()
checkpoint_map = available_checkpoints ()
aspect_extractor = ATEPC . AspectExtractor ( 'multilingual' ,
auto_device = True , # False means load model on CPU
cal_perplexity = True ,
)
# instance inference
aspect_extractor . predict ([ 'I love this movie, it is so great!' ],
save_result = True ,
print_result = True , # print the result
ignore_error = True , # ignore the error when the model cannot predict the input
)
inference_source = ATEPC . ATEPCDatasetList . Restaurant16
atepc_result = aspect_extractor . batch_predict ( target_file = inference_source , #
save_result = True ,
print_result = True , # print the result
pred_sentiment = True , # Predict the sentiment of extracted aspect terms
)
print ( atepc_result )
from pyabsa import AspectPolarityClassification as APC , available_checkpoints
# you can view all available checkpoints by calling available_checkpoints()
checkpoint_map = available_checkpoints ( show_ckpts = True )
classifier = APC . SentimentClassifier ( 'multilingual' ,
auto_device = True , # False means load model on CPU
cal_perplexity = True ,
)
# instance inference
classifier . predict ([ 'I love this movie, it is so great!' ],
save_result = True ,
print_result = True , # print the result
ignore_error = True , # ignore the error when the model cannot predict the input
)
inference_source = APC . APCDatasetList . Laptop14
apc_result = classifier . batch_predict ( target_file = inference_source , #
save_result = True ,
print_result = True , # print the result
pred_sentiment = True , # Predict the sentiment of extracted aspect terms
)
print ( apc_result )請參閱文檔:PYABSA文檔。如果您對文檔有任何疑問,請隨時提出問題。另外,您可以加入以改進文檔。
該存儲庫基於我們的ABSA研究論文。這是您可以引用或參考實施的論文:
如果您正在尋找本地環境重點的原始建議,這裡有一些介紹。
@inproceedings { YangZL23 ,
author = { Heng Yang and
Chen Zhang and
Ke Li } ,
editor = { Ingo Frommholz and
Frank Hopfgartner and
Mark Lee and
Michael Oakes and
Mounia Lalmas and
Min Zhang and
Rodrygo L. T. Santos } ,
title = { PyABSA: {A} Modularized Framework for Reproducible Aspect-based Sentiment
Analysis } ,
booktitle = { Proceedings of the 32nd {ACM} International Conference on Information
and Knowledge Management, {CIKM} 2023, Birmingham, United Kingdom,
October 21-25, 2023 } ,
pages = { 5117--5122 } ,
publisher = { {ACM} } ,
year = { 2023 } ,
url = { https://doi.org/10.1145/3583780.3614752 } ,
doi = { 10.1145/3583780.3614752 } ,
timestamp = { Thu, 23 Nov 2023 13:25:05 +0100 } ,
biburl = { https://dblp.org/rec/conf/cikm/0008ZL23.bib } ,
bibsource = { dblp computer science bibliography, https://dblp.org }
}該存儲庫是由Heng Yang(Yangheng95@github)開發和維護的,社區研究人員的貢獻很大。我們希望您可以幫助我們改進該項目,歡迎您的貢獻。您可以在許多方面做出貢獻,包括:
PYABSA是根據MIT許可發布的,請引用此回購(或論文)或附加作者信息(存儲庫,博客,產品等)