private BratNameSampleStream createNameSampleWith(String nameContainsFilter,
Set<String> nameTypes) throws IOException {
Map<String, String> typeToClassMap = new HashMap<>();
BratAnnotationStreamTest.addEntityTypes(typeToClassMap);
AnnotationConfiguration config = new AnnotationConfiguration(typeToClassMap);
File dir = new File(this.getClass().getResource("/opennlp/tools/formats/brat/").getFile());
FileFilter fileFilter = pathname -> pathname.getName().contains(nameContainsFilter);
ObjectStream<BratDocument> bratDocumentStream = new BratDocumentStream(config, dir,
false, fileFilter);
return new BratNameSampleStream(new NewlineSentenceDetector(),
WhitespaceTokenizer.INSTANCE, bratDocumentStream, nameTypes);
}