german sentiment bert

oliverguhr

Introduction

The German Sentiment BERT model is designed for sentiment classification of German language texts. This model utilizes Google's BERT architecture and is intended for a variety of German text domains, such as social media and reviews.

Architecture

The model architecture is based on Google's BERT, a pre-trained transformer model renowned for its capability in handling text classification tasks. It was trained on 1.834 million German-language samples from diverse domains, including Twitter, Facebook, and various reviews.

Training

The model's training involved preprocessing text data to ensure consistency in input data format. This preprocessing step is crucial to replicate the training conditions. Detailed information about the dataset and training methodology can be found in the associated research paper.

Guide: Running Locally

To use the German Sentiment BERT model locally, follow these steps:

  1. Install the Python package:

    pip install germansentiment
    
  2. Load and use the model:

    from germansentiment import SentimentModel
    
    model = SentimentModel()
    texts = ["Mit keinem guten Ergebniss", "Das ist gar nicht mal so gut", "Total awesome!", "nicht so schlecht wie erwartet", "Der Test verlief positiv.", "Sie fährt ein grünes Auto."]
    result = model.predict_sentiment(texts)
    print(result)
    
  3. Output class probabilities:

    classes, probabilities = model.predict_sentiment(["das ist super"], output_probabilities=True)
    print(classes, probabilities)
    

For enhanced performance, consider using a cloud GPU service such as AWS EC2 with GPU instances, Google Cloud, or Azure.

License

The German Sentiment BERT model is released under the MIT License, allowing for flexible use and modification.

More Related APIs in Text Classification