File size: 813 Bytes
97f37a2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from model import PredictSentiment
import pandas as pd

# ===== Contoh pemakaian =====
if __name__ == "__main__":
    # Contoh DataFrame input
    data = {
        'text': [
            "Very Bad trailer, the worst one in the history of game",
            "I would watch the trailer for another 100 years",
            "Such a nostalgic moment"
        ],
        'aspects': [
            ["Gameplay", "Trailer & Hype"],
            ["Gameplay", "Nostalgia"],
            ["Gameplay", "Nostalgia"]
        ],
        'proba_values': [
            [0.9782, 0.8123],
            [0.5985, 0.4789],
            [0.8624, 0.4191]
        ]
    }

    df_test = pd.DataFrame(data)

    sentiment_model = PredictSentiment()
    df_result = sentiment_model.predict(df_test)
    print(df_result)