Measuring social polarization with ordinal and categorical data