yangheng95 / PyABSA

Sentiment Analysis, Text Classification, Text Augmentation, Text Adversarial defense, etc.;
https://pyabsa.readthedocs.io
MIT License
902 stars 153 forks source link

Problem report: extracted bad aspect results #353

Open combokang opened 9 months ago

combokang commented 9 months ago

Please provide the REQUIRED information. Otherwise, It is almost impossible to locate the problem. DO NOT CHANGE THE FORM.

PyABSA Version (Required)

Python Version: 3.10.6
PyABSA Version: 2.0.27
Torch Version: 1.13.1
Transformers Version: 4.26.0

Code To Reproduce (Required)

from pyabsa import AspectTermExtraction as ATEPC

atepc_examples = "  * * * HITS BLUNT * * * What a great time I had discovering a live band and tasty food in this place . Went for momo ’ s , ended with not only momo ’ s but a great variety that was delightful . Great friendly service was appreciated . The Himalayan black salt drink ( maybe needs a little side note to let people what to expect ) . Will be back !"

aspect_extractor = ATEPC.AspectExtractor(
    checkpoint="fast_lcf_atepc_custom_dataset_fusion_apcacc_90.15_apcf1_79.29_atef1_82.32",
    auto_device=True,
    cal_perplexity=True,
)

aspect_extractor.predict(
    text=atepc_examples,
    #save_result=True,
    save_result=False,
    print_result=True,
    pred_sentiment=True,
)

Full Console Output (Required)

Example 0:   * * * HITS BLUNT * * * What a <great:Positive Confidence:0.9958400726318359> time I had discovering a <live:Positive Confidence:0.9953206181526184> band and <tasty:Positive Confidence:0.9955742359161377> food in this place . Went <for:Positive Confidence:0.9764904975891113> momo ’ s , ended with not only momo ’ s but a great variety that was delightful . Great <friendly:Positive Confidence:0.950766921043396> service was appreciated . The Himalayan black <salt:Negative Confidence:0.6763073801994324> drink ( maybe needs a little side note to let people what to expect ) . Will be back !

Describe the bug

The program extracted 6 aspects but seems wrong, looks like it should more likely return the tokens on the right of the current results. Seems a bug.
Current results: great, live, tasty, for, friendly, salt.

Expected behavior

Expected results: time, band, food, momo, service, drink.
yangheng95 commented 9 months ago

It seems the position shifts and causes this problem. However, I have had a tight schedule recently, so before I fix this issue, please try to do it yourself and PR.

combokang commented 9 months ago

I don't think I have the ability to fix this problem, so anyone who can fix this problem is a big thanks.

yangheng95 commented 9 months ago

Is this an instance-level or dataset-level error? @combokang

combokang commented 9 months ago

Instance-level.