Output unique label and class pairs per document.

See NCBO-972.
Merge branch 'ncbo-972'