use of org.apache.tika.mime.ProbabilisticMimeDetectionSelector.Builder in project tika by apache.
the class ProbabilisticMimeDetectionTestWithTika method setUp.
/** @inheritDoc */
@Before
public void setUp() {
MimeTypes types = MimeTypes.getDefaultMimeTypes();
ServiceLoader loader = new ServiceLoader();
registry = types.getMediaTypeRegistry();
/*
* here is an example with the use of the builder to
* instantiate the object.
*/
Builder builder = new ProbabilisticMimeDetectionSelector.Builder();
proSelector = new ProbabilisticMimeDetectionSelector(types, builder.priorMagicFileType(0.5f).priorExtensionFileType(0.5f).priorMetaFileType(0.5f));
DefaultProbDetector detector = new DefaultProbDetector(proSelector, loader);
// Use a default Tika, except for our different detector
tika = new Tika(detector);
}
Aggregations