Makernotes usually store the lens type in some way. Sometime as a string, sometime as an numerical ID, or something else. There is not standard and it is mostly per vendor.
References
Nikon
Pentax
Canon
- Canon LensType from ExifTool Canon cameras do not have a reliable "?LensType" field. For example my 20D does not and put 0xffff, while some later Rebel model does.
So there are two ways: if you have a consistent ?CameraSettings.?LensType, use it.
If you don't (0xffff for example) you have other lens info that should allow to reduce the list to a bunch and require some user selection for the few last cases. For that there are a few fields in the makernotes:
First the ?FocalLength.?FocalType to see if it is a zoom or a prime.
Second ?CameraSettings.?LongFocal and ?ShortFocal, and ?MaxAperture + ?MinAperture.