45d7f12d66addc6235333e70ebefefce96b86150,underthesea/sentiment/general/__init__.py,,sentiment,#Any#,18

Before Change


def sentiment(text):
    global classifier
    if not classifier:
        if os.path.exists(model_path):
            classifier = TextClassifier.load(model_path)
        else:
            logger.error(
                f"Could not load model at {model_path}.\n"
                f"Download model with \"underthesea download {UTSModel.sa_general.value}\".")
            sys.exit(1)
    sentence = Sentence(text)
    classifier.predict(sentence)
    label = sentence.labels[0]
    if label == "1":

After Change


        label = label_map[labels[0]]
        return label
    except Exception:
        return None
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: undertheseanlp/underthesea
Commit Name: 45d7f12d66addc6235333e70ebefefce96b86150
Time: 2021-01-07
Author: anhv.ict91@gmail.com
File Name: underthesea/sentiment/general/__init__.py
Class Name:
Method Name: sentiment


Project Name: undertheseanlp/underthesea
Commit Name: 45d7f12d66addc6235333e70ebefefce96b86150
Time: 2021-01-07
Author: anhv.ict91@gmail.com
File Name: underthesea/classification/bank/__init__.py
Class Name:
Method Name: classify


Project Name: undertheseanlp/underthesea
Commit Name: 45d7f12d66addc6235333e70ebefefce96b86150
Time: 2021-01-07
Author: anhv.ict91@gmail.com
File Name: underthesea/sentiment/bank/__init__.py
Class Name:
Method Name: sentiment