NUSTM / ACOS

The datasets and code of ACL 2021 paper "Aspect-Category-Opinion-Sentiment Quadruple Extraction with Implicit Aspects and Opinions".
194 stars 29 forks source link

How to prepare inference script from model output #12

Open aminul-palash opened 1 year ago

aminul-palash commented 1 year ago

Hello, I'm getting output like this, But could not get any common pattern to extract and prepare inference script. I want to see specific aspect with corresponding opinion. i really love their environment , people but service and food taste was worst . a-4,5 a-6,7 a-8,9 a-10,11 o-2,3 o-13,14 delicious chicken fry , brown cream coffee and green tea but worst cheese pizza , beef and chicken salad . a-1,3 a-4,7 a-8,10 a-12,14 a-15,17 a-17,19 o-0,1 o-11,12 the chicken fry was not so good . the green tea was not bad . a-1,3 a-9,11 o-4,7 o-12,14

thanks.

blhoy commented 1 year ago

Hi, This should be the results of the first step (aspect opinion co-extraction), the "a-4,5" means an aspect range from index 4 to 5 is extracted, and the "o-2,3" means an opinion range from index 2 to 3 is extracted.

After matching the aspects and the opinions by the script (https://github.com/NUSTM/ACOS/blob/main/Extract-Classify-ACOS/run.sh#L25), we can further get the valid aspect-opinion pairs by step 2 (https://github.com/NUSTM/ACOS/blob/main/Extract-Classify-ACOS/run.sh#L30). The results should be stored in (https://github.com/NUSTM/ACOS/blob/main/Extract-Classify-ACOS/run.sh#L43)

aminul-palash commented 1 year ago

Thanks @blhoy for your early reply. But after running last part of sh file . the generated data are like this: the chicken fry was delicious , delivery was not satisfactory . 1,3 4,5

FOOD#QUALITY#2

the chicken fry was delicious , delivery was not satisfactory . 1,3 8,10

the chicken fry was delicious , delivery was not satisfactory . 6,7 4,5

FOOD#QUALITY#2

the chicken fry was delicious , delivery was not satisfactory . 6,7 8,10

SERVICE#GENERAL#0

Here it is giving all opinions for each aspect. I think there is some mistake from me. But can't figure out. Need support.

Thanks in advance.

blhoy commented 1 year ago

The first line consists of "Review text+aspect+opinion", and the second line is the predicted "category+sentiment" of the given aspect-opinion pair.

The "FOOD#QUALITY" is the category in the "FOOD#QUALITY#2", and the "2" is the sentiment. 0, 1, 2 means negative, neutral, and positive, respectively.

The third line without corresponding category-sentiment pair means that the given aspect-opinion pair "1,3 8,10" is not a valid aspect-opinion pair.

aminul-palash commented 1 year ago

after running first scripts. I've got output like this:

the service was excellent , the coffee was good even by starbucks standards and the food was outstanding . 1,2 3,4

SERVICE#GENERAL#2   

the service was excellent , the coffee was good even by starbucks standards and the food was outstanding . 1,2 8,9

SERVICE#GENERAL#2   

the service was excellent , the coffee was good even by starbucks standards and the food was outstanding . 1,2 17,18

the service was excellent , the coffee was good even by starbucks standards and the food was outstanding . 6,7 3,4

the service was excellent , the coffee was good even by starbucks standards and the food was outstanding . 6,7 8,9

DRINKS#QUALITY#2    

the service was excellent , the coffee was good even by starbucks standards and the food was outstanding . 6,7 17,18

FOOD#QUALITY#2  

the service was excellent , the coffee was good even by starbucks standards and the food was outstanding . 15,16 3,4

FOOD#QUALITY#2  

the service was excellent , the coffee was good even by starbucks standards and the food was outstanding . 15,16 8,9

FOOD#QUALITY#2  

the service was excellent , the coffee was good even by starbucks standards and the food was outstanding . 15,16 17,18

FOOD#QUALITY#2  

and after running second part of the sh file.

there was a really nice vibe about the place . . . good music , atmosphere and happy looking people .   a-5,6   a-8,9   a-13,14 a-15,16 a-19,20 o-4,5   o-12,13 o-17,19
the service was excellent , the coffee was good even by starbucks standards and the food was outstanding .  a-1,2   a-6,7   a-15,16 o-3,4   o-8,9   o-17,18

But I have observed that final output is not good compared to first (aspect-opinion) output. Am I doing any wrong or these results are okay ?

blhoy commented 1 year ago

The results of step 2 should be like this (stored in https://github.com/NUSTM/ACOS/blob/main/Extract-Classify-ACOS/eval_metrics.py#L365):

green tea cr ##eme br ##ule ##e is a must ! 0,7 9,10
FOOD#QUALITY#2  
FOOD#QUALITY#2  

it has great su ##shi and even better service . 3,5 2,3
FOOD#QUALITY#2  
FOOD#QUALITY#2  

it has great su ##shi and even better service . 8,9 7,8
SERVICE#GENERAL#2   
SERVICE#GENERAL#0   

After get the file "pred4pipeline.txt", we can prepare the input file "domian_type+'_test_pair_1st.tsv'" for step 2 by "https://github.com/NUSTM/ACOS/blob/main/Extract-Classify-ACOS/tokenized_data/get_1st_pairs.py".