Autocorrelation of discrete time series

#1
I am currently planning on calculating the autocorrelation for various lags given a time series. However, my elements of the time series are "discrete" and abstract classes; i.e., no integers.

For example, my series could look like:

class A, class B, class A, class A ...

Of course I could now say that class A = 1 and class B = 2 and then use the common Pearson correlation way for determining the autocorrelation. However, this seems to be problematic to me, because the value of the number does not express anything.

Is there some way around this?