docs: @POST
      @Consumes(MediaType.APPLICATION_JSON)
      @Produces({MediaType.APPLICATION_JSON, MediaType.TEXT_XML})
      public static Collection<Utterance> mapTextWithOptions(final AnalysisRequest r)
              throws IOException, InterruptedException, JAXBException, SQLException, ParserConfigurationException,
                     SAXException {
  
          System.out.println(r);
  
          // metamap options
          final Collection<Option> opts = new ArrayList<>();
          final Set<String> optionNames = new HashSet<>();
          for (final String o : r.getOptions()) {
              final Option opt = MetaMapOptions.strToOpt(o);
              if (opt != null) {
                  optionNames.add(opt.name());
                  if (!opt.useProcessorDefault()) opts.add(opt);
              }
          }
          // always make sure we have a restrict_to_sources option
          if (!optionNames.contains(new RestrictToSources().name())) opts.add(new RestrictToSources());
  
          // tmp files for metamap in/out
          final File infile = File.createTempFile("metamap-input-", ".txt");
          final File outfile = File.createTempFile("metamap-output-", ".xml");
          final String s = r.getText() + (r.getText().endsWith("\n") ? "" : "\n");
          final String ascii = MetaMap.decomposeToAscii(URLDecoder.decode(s, "UTF-8"));
          Files.write(ascii, infile, Charsets.UTF_8);
          // we don't want too much data for a free service
          if (infile.length() > MAX_DATA_BYTES) {
              throw new WebApplicationException(
                      Response.status(Responses.NOT_ACCEPTABLE)
                              .entity("Too much data, currently limited to " + MAX_DATA_BYTES + " bytes.")
                              .type("text/plain").build()
              );
          }
  
          // process the data with MetaMap
          final MetaMap metaMap = new MetaMap(PUBLIC_MM_DIR, opts);
          if (!metaMap.process(infile, outfile)) {
              throw new WebApplicationException(Response.status(INTERNAL_SERVER_ERROR)
                                                        .entity("Processing failed, aborting.")
                                                        .type("text/plain").build());
          }
  
          // look up the SNOMED codes from the UMLS CUI code/description combinations returned by MetaMap
          final MMOs root = JaxbLoader.loadXml(outfile);
          try (final SnomedLookup snomedLookup = new SnomedLookup(DB_PATH)) {
              snomedLookup.enrichXml(root);
          }
  
          //noinspection ResultOfMethodCallIgnored
          infile.delete();
          //noinspection ResultOfMethodCallIgnored
          outfile.delete();
  
          return destructiveFilter(root);
      }