Unsupervised clustering of unstructured text by document type I have 100,000+ PDF healthcare documents from which I have extracted text. I would like to cluster these documents by type (e.g. pathology report, doctor visit notes, prescription orders, etc.)

The format and structure of the documents are unknown ahead of time. However, we can assume that the name of the document type occurs explicitly somewhere within the first 50 words of each document. E.g. A pathology report will contain the words "pathology report" somewhere near the top.

The contents of the documents are otherwise irrelevant. I simply want to cluster documents together by document type.

I do not know the names or number of document types ahead of time. I would like the algorithm to automatically determine the best number of clusters.

I'm not very experienced in machine learning, but I am a competent programmer. What's the best way to attack this problem? Thanks.
"pathology report, doctor visit notes, prescription orders" these are classes, not clusters. Clustering may as well find "people with headache", "patients on Thursdays", ... you do not get to control this unsupervised.

So I'd rather suggest to do a classification.

For example, put all documents that contain "patient report" in the first lines into a separate set. Inspect the remainder for another keyword. Add another rule. If the data is as explained, 10 such rules may get the leftover documents down to a manageable scale, and they could eventually just be treated as 'others'.

There is nothing wrong with inspecting documents and adding rules if that solves your problem. You probably don't need to make this work on different document collections (say, law texts) ever.