Chapter 6. Text and Language

This chapter explores the practical side of implementing text- and language-related AI features in your Swift apps. Taking a top-down approach, we explore five text and language tasks and how to implement them using a variety of AI tools.

Practical AI, Text, and Language

The five text and language tasks that we explore in this chapter are:

Language Identification

Determining what language some text might be in.

Named Entity Recognition

Identifying the elements of text that are people, places, or organizations.

Lemmatization, tagging, tokenization Identifying the lemma of every word in a string, finding the parts of speech (verbs, nouns, and so on), and splitting a string up by words.

Sentiment Analysis

Determining whether some text has a positive or negative sentiment.

Custom Text Classifiers

Another way of classifying text for sentiment, extending Apple’s tools.

Note

In Chapter 8, we also look at generating text. We put that task there because we think it’s more closely related to generating things than it is to text. But really, you’re probably reading the whole book, so it doesn’t matter where it goes.

Images, human movement, and sound might be flashy, but the majority of apps you’ll build in your life will also, or perhaps primarily, deal with text. Humans generate vast amounts of text, and it’s often useful to be able to use a clever machine to figure out what’s going on with text so that you can make decisions or show the user something ...

Get Practical Artificial Intelligence with Swift now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.