Warum Stimmungsanalyse?
Weil Du wissen willst, was die Kunden wirklich sagen.
Nicht jede Kritik ist ein âReklamationsgrundâ.
Nicht jedes Lob ein âKaufimpulsâ.
Aber die Richtung â positiv, neutral, negativ â lĂ€sst sich automatisiert rausfiltern.
Mit KI. Und Access als OberflÀche.
Ich zeig Dir, wie Du Kundenfeedback automatisch analysierst â direkt in Deiner Access-Anwendung.
Was Du brauchst
- Microsoft Access
- OpenAI API-Key (GPT) oder Hugging Face Sentiment-Modell
- Tabellen fĂŒr Feedback, Ergebnisse, Fehler
- Etwas VBA und JSON-Kleber
Tabellenstruktur
Tabelle | Zweck |
---|---|
tblFeedback | Kundentexte |
tblAnalyse | Stimmung, Score, Timestamp |
tblFehlerlog | Fehler beim API-Call |
Beispiel-Eintrag
ID | Kunde | Text |
---|---|---|
42 | 0815 | âDie Lieferung war schnell, aber die Ware schlecht verpackt.â |
GPT versteht das. Und sagt Dir:
Mixed â Tendenz: negativ
Variante A: GPT fĂŒr Sentiment
VBA-Funktion fĂŒr Analyse
Function AnalyseStimmungGPT(text As String) As String
Dim http As Object
Dim prompt As String
Dim apiKey As String
Dim json As String
apiKey = "DEIN_API_KEY"
prompt = "Analysiere folgenden Kundentext: """ & text & """." & _
" Gib nur eine Antwort als JSON mit Feldern ""stimmung"" und ""score""." & _
" Stimmung = positiv / neutral / negativ. Score = Zahl von -1 bis 1."
json = "{" & _
"""model"":""gpt-4""," & _
"""messages"":[{""role"":""user"",""content"":""" & Replace(prompt, """", "\""") & """}]" & _
"}"
Set http = CreateObject("MSXML2.ServerXMLHTTP")
http.Open "POST", "https://api.openai.com/v1/chat/completions", False
http.setRequestHeader "Authorization", "Bearer " & apiKey
http.setRequestHeader "Content-Type", "application/json"
http.Send json
AnalyseStimmungGPT = http.responseText
End Function
JSON-Ausgabe extrahieren
Function ParseGPTStimmung(json As String) As String
Dim sc As Object
Set sc = CreateObject("ScriptControl")
sc.Language = "JScript"
sc.AddCode "function parse(j){var t=JSON.parse(j).choices[0].message.content;return t;}"
ParseGPTStimmung = sc.Run("parse", json)
End Function
Du bekommst dann z.âŻB.:
{
"stimmung": "negativ",
"score": -0.6
}
In Access speichern
Sub SpeichereStimmung(feedbackID As Long, stimmung As String, score As Double)
CurrentDb.Execute "INSERT INTO tblAnalyse (FeedbackID, Stimmung, Score, Zeitstempel) VALUES (" & _
feedbackID & ", '" & stimmung & "', " & Replace(score, ",", ".") & ", Now())"
End Sub
Variante B: Hugging Face Modell
Falls Du lieber was Fixes nutzt:
Modell distilbert-base-uncased-finetuned-sst-2-english
API-Aufruf:
Function AnalyseStimmungHF(text As String) As String
Dim http As Object
Dim token As String
Dim json As String
token = "DEIN_HUGGINGFACE_TOKEN"
json = "{""inputs"":""" & Replace(text, """", "\""") & """}"
Set http = CreateObject("MSXML2.ServerXMLHTTP")
http.Open "POST", "https://api-inference.huggingface.co/models/distilbert-base-uncased-finetuned-sst-2-english", False
http.setRequestHeader "Authorization", "Bearer " & token
http.setRequestHeader "Content-Type", "application/json"
http.Send json
AnalyseStimmungHF = http.responseText
End Function
Beispielantwort:
[ { "label": "NEGATIVE", "score": 0.95 } ]
Kannst Du dann Àhnlich verarbeiten wie bei GPT.
Feedback durchklicken im Formular
Private Sub btnAnalysieren_Click()
Dim id As Long
Dim text As String
Dim json As String
Dim stimmung As String
Dim score As Double
id = Me.txtFeedbackID
text = Me.txtFeedback
json = AnalyseStimmungGPT(text)
stimmung = ParseGPTFeld(json, "stimmung")
score = CDbl(ParseGPTFeld(json, "score"))
Call SpeichereStimmung(id, stimmung, score)
Me.txtStimmung = stimmung
Me.txtScore = score
End Sub
Feld extrahieren aus JSON
Function ParseGPTFeld(jsonText As String, feld As String) As String
Dim sc As Object
Set sc = CreateObject("ScriptControl")
sc.Language = "JScript"
sc.AddCode "function val(j,f){return JSON.parse(j).choices[0].message.content.match(new RegExp('""" & feld & """:\\s*[""\\-\\d\\.a-zA-Z]+'))[0].split(':')[1].trim().replace(/^[""']|[""']$/g, '');}"
ParseGPTFeld = sc.Run("val", jsonText, feld)
End Function
Was Du analysieren kannst
- Offene Kundenkommentare aus Tickets
- Google-Bewertungen
- Texte aus Webformularen
- E-Mail-AuszĂŒge aus Outlook â per VBA importierbar
Was sinnvoll ist
Anwendungsfall | Vorteil |
---|---|
Sortierung nach Stimmung | Vorab-Filter fĂŒr Service |
Durchschnittswerte pro Kunde | FrĂŒhwarnsystem |
Drilldown im Report | Zeig nur âkritischeâ FĂ€lle |
Trendanalyse ĂŒber Monate | Stimmung verschlechtert sich? |
Was Du beachten musst
- GPT: Ergebnis hĂ€ngt vom Prompt ab â gern mal testen
- Keine personenbezogenen Daten direkt senden
- Langfristig: lokal mit fine-tuned Modell besser skalierbar
- API-Limits prĂŒfen (Token bei GPT, Volumen bei HF)
âAccess hat keine Meinung â aber er kennt jetzt die vom Kunden.â
Wenn Du Kundenstimmen auswerten willst:
Ich helf Dir beim Aufsetzen.
Ohne Marketing-Magie. Aber mit Wirkung.
No responses yet