Tutorial > Analyzing Text


A phoneme is a single "unit" of sound that has meaning in any language. Each phoneme represents a different sound a person can make. Since there are only 26 letters in the alphabet (and about 40 phonemes), sometimes letter combinations are used to make a phoneme. Here is an example:

chef = /ʃef/
choir = /kwaɪə/
cheese = /tʃi:z/

The "ch" letter combination has three different pronunciations, which are represented by three different phonemes: /ʃ/, /k/ and /tʃ/.

In RiTa, we use Arpabet to represent the phonemes (or phones). Arpabet is a phonetic transcription code developed by Advanced Research Projects Agency (ARPA) as a part of the Speech Understanding Project. It represents each phoneme of English with a distinct sequence of ASCII characters.

The above example would be translated like this if we use Arpabet:

chef = ch eh f
choir = k w ay r
cheese = ch iy z

You can use RiTa.phones to analyse the phonemes.

RiTa.phones("An elephant is a mammal");

It will return: 'ae-n eh-l-ax-f-ax-n-t ih-z ey m-ae-m-ax-l'.

A list of the phonemes used in RiTa:

The reference list from Arpabet to IPA:


In phonetics, stress refers to the degree of emphasis given to a sound or syllable in speech, resulting in relative loudness. This is also sometimes called lexical stress or word stress.

RiTa.stresses analyzes text and returns a new string containing the stress for each syllable of the input.


In this case, it returns 0/1/0, with a 1 meaning 'stressed', and 0 means ‘unstressed’: e.g., com-PUTE-er

POS (Part of speech)

Each part-of-speech is a category of words which have similar grammatical properties. Words that are assigned to the same part-of-speech play similar roles within the structure of sentences. Commonly used English parts of speech are noun, verb, adjective, adverb, pronoun, preposition, conjunction, article, etc.

You can use RiTa.pos to analyze the part-of-speech (or POS) for you.

RiTa.pos("I am hungry");

The outcome would be:

[ "prp", "vbp", "jj" ]

Here you can find the Penn part-of-speech tags used by the tagger in RiTa.

By default RiTa uses the Penn tag set and it is very detailed. If you only need the very basic POS categories, you can switch to using simple tags

RiTa.pos("I am hungry", { simple: true });
which covers only the following basic categories:

n -> NOUN
v -> VERB