-
Notifications
You must be signed in to change notification settings - Fork 166
/
Copy pathextract_aspects.py
24 lines (19 loc) · 1.1 KB
/
extract_aspects.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# -*- coding: utf-8 -*-
# file: extract_aspects.py
# time: 2021/5/27 0027
# author: yangheng <[email protected]>
# github: https://github.com/yangheng95
# Copyright (C) 2021. All Rights Reserved.
from pyabsa import ABSADatasetList, available_checkpoints
from pyabsa import ATEPCCheckpointManager
# checkpoint_map = available_checkpoints(from_local=False)
aspect_extractor = ATEPCCheckpointManager.get_aspect_extractor(checkpoint='english2',
auto_device=True # False means load model on CPU
)
inference_source = ABSADatasetList.SemEval
atepc_result = aspect_extractor.extract_aspect(inference_source=inference_source, #
save_result=True,
print_result=True, # print the result
pred_sentiment=True, # Predict the sentiment of extracted aspect terms
)
# print(atepc_result)