concept distribution in category nlp

This is an excerpt from Manning's book Getting Started with Natural Language Processing.
An accuracy of 60% seems to not be very high, but how exactly can you interpret it? Note that the distribution of classes helps you to put the performance of your classifier in context because it tells you how challenging the problem itself is. For example, with the 50%-50% split, there is no majority class in the data and the classifier’s random guess will be at 50%, so the classifier’s accuracy is higher than this random guess. In the second case, however, the classifier performs on a par with a majority class guesser: the 60% to 40% distribution of classes suggests that if some dummy “classifier” always selected the majority class, it would get 60% of the cases correctly – just like the classifier you trained.
This question may remind you of a similar discussion in Chapter 2: we said then that in order to interpret whether accuracy is high or low you need to know what the distribution of classes is. In isolation, 0.60 does not seem like a high number. If this accuracy is achieved by an algorithm on a set with a 50-50% distribution between 2 classes, an accuracy of 0.60 does not seem to be very impressive. Worse still, if the distribution of the two classes is closer to 60-40%, such an algorithm performs hardly better than a majority baseline algorithm that always selects the majority class without doing any learning. However, on a 10-class problem with an equal distribution of data between the classes (i.e., 10% each), an accuracy of 0.60 would not seem to be as low.
Listing 6.9 Code to add distribution of part-of-speech tags as features from collections import Counter #A pos_list = ["C", "D", "E", "F", "I", "J", "M", "N", "P", "R", "T", "U", "V", "W"] #B def pos_counts(text, source_docs, pos_list): #C pos_counts = {} doc = source_docs.get(" ".join(text)) tags = [] for word in doc: tags.append(str(word.tag_)[0]) #D counts = Counter(tags) for pos in pos_list: if pos in counts.keys(): pos_counts[pos] = counts.get(pos) else: pos_counts[pos] = 0 #E return pos_counts def initialize_dataset(source, source_docs): all_features = [] targets = [] for (sent, label) in source: feature_list=[] feature_list.append(avg_number_chars(sent)) feature_list.append(number_words(sent)) counts = word_counts(sent) for word in STOP_WORDS: if word in counts.keys(): feature_list.append(counts.get(word)) else: feature_list.append(0) feature_list.append(proportion_words(sent, STOP_WORDS)) #F p_counts = pos_counts(sent, source_docs, pos_list) for pos in p_counts.keys(): feature_list.append(float(p_counts.get(pos))/float(len(sent))) #G all_features.append(feature_list) if label=="austen": targets.append(0) else: targets.append(1) return all_features, targets