Exit e-book
Show all chapters
02
Definition of the Problem
02. 
Definition of the Problem

Sign up to our Newsletter

Signing up to our newsletter allows you to read all our ebooks.

    Do You Trust in Aspect-Based Sentiment Analysis?
    02

    Definition of the Problem

    The aim is to classify the sentiments of a text concerning given aspects. We have made several assumptions to make the service more helpful. Namely, the text being processed might be a full-length document, the aspects could contain several words (so may be defined more precisely), and most importantly, the service should provide an approximate explanation of any decision made, therefore, a user will be able to immediately infer the reliability of a prediction.

    import aspect_based_sentiment_analysis as absa
    
    nlp = absa.load()
    text = ("We are great fans of Slack, but we wish the subscriptions "
            "were more accessible to small startups.")
    
    slack, price = nlp(text, aspects=['slack computer program', 'price'])
    assert price.sentiment == absa.Sentiment.negative
    assert slack.sentiment == absa.Sentiment.positive

    Above is an example of how quickly you can start to benefit from our open-source package. All you need to do is to call the load function which sets up the ready-to-use pipeline nlp. You can explicitly pass the model name you wish to use (a list of available models is here), or a path to your model. In spite of the simplicity of using fine-tune models, we encourage you to build a custom model which reflects your data. The predictions will be more accurate and stable, something which we will discuss later on. 

    PREVIOUS
    Chapter
    01
    NEXT
    Chapter
    03