Apple's sentiment analysis thinks 'delete the temp file' is a death threat

NLTagger is Apple’s API for sentiment analysis. It’s integrated into iOS and macOS, runs on-device, needs no server, and is three lines of code away. It’s the first thing you find when searching for “sentiment analysis Swift”. Here’s what it returns for text any developer would write on a normal day: Message NLTagger Reality “delete the temp file” -0.8 Neutral instruction “ok” -0.8 Neutral confirmation “run make test” -0.6 Neutral instruction “commit and push” -0.4 Neutral instruction “great job, thanks!” +1.0 Positive (correct) “this is fucking broken” -1.0 Negative (correct) The scale goes from -1.0 (very negative) to +1.0 (very positive). According to Apple, “delete the temp file” carries almost the same emotional weight as “this is fucking broken”. And “ok” – the most neutral response in the English language – scores -0.8. ...

April 5, 2026 · Fernando

NLTagger and Sentiment Analysis: Why Apple Thinks Your Code is Depressing

Imagine you’re building an app that analyzes conversations within a development team. You want to detect whether the team’s tone is healthy or if there are signs of stress. You decide to use Apple’s NLTagger because it’s readily available, free, runs on-device, and doesn’t require a server. Three lines of code, and off you go. First surprise: the phrase “kill the process and restart the daemon” scores -0.6. Negative. Almost hostile. “Fatal error in memory allocation” gets a -0.8. And “crash report uploaded successfully” — which is literally good news — scores -0.4. ...

March 28, 2026 · Fernando