Tone, Sentiment, language analysis on iPhone - Ideas

Hi everyone,

I’m exploring ideas around on-device analysis of user typing behavior on iPhone, and I’d love input from others who’ve worked in this area or thought about similar problems.

Conceptually, I’m interested in things like:

  • High-level sentiment or tone inferred from what a user types over time using ML-models
  • Identifying a user’s most important or frequent topics over a recent window (e.g., “last week”)
  • Aggregated insights rather than raw text (privacy-preserving summaries: e.g., your typo-rate by hour to infer highly efficient time slots or "take-a-break" warning typing errors increase)

I understand the significant privacy restrictions around keyboard input on iOS, especially for third-party keyboards and system text fields. I’m not trying to bypass those constraints—rather, I’m curious about what’s realistically possible within Apple’s frameworks and policies. (For instance, Grammarly as a correction tool includes some information about tone)

Questions I’m thinking through:

  • Are there any recommended approaches for on-device text analysis that don’t rely on capturing raw keystrokes?

  • Has anyone used NLP / Core ML / Natural Language successfully for similar summarization or sentiment tasks, scoped only to user-explicit input?

  • For custom keyboards, what kinds of derived or transient signals (if any) are acceptable to process and summarize locally?

  • Any design patterns that balance usefulness with Apple’s privacy expectations?

If you’ve built something adjacent—journaling, writing analytics, well-being apps, etc.—I’d appreciate hearing what worked, what didn’t, and what Apple reviewers were comfortable with.

Thanks in advance for any ideas or references 🙏

Hi @YTerhorst,

You're on the right track by mentioning CoreML and Natural Language. The most straightforward approach would be to utilize Natural Language Framework, which has built-in and on-device capabilities for text sentiment analysis.

You can use NLTagger with the sentimentScore NLTagScheme to determine the sentiment polarity of text. This scheme assigns a score ranging from -1.0 (most negative) to 1.0 (most positive), with 0.0 indicating a neutral sentiment.

Additionally, Foundation Models framework offers a lot of functionality for analyzing text using an optimized on-device language model.

Finally, if you're looking for a more custom implementation, you can look into CoreML, which allows your app to utilize custom machine learning models.

In regards to user privacy, a good place to get started is with our design guidelines around privacy.

Best,

-J

Tone, Sentiment, language analysis on iPhone - Ideas
 
 
Q