<commit_before>#include "dnn.h"

#ifndef __FF_DNNBINDINGS_H_
#define __FF_DNNBINDINGS_H_

namespace DnnBindings {

  struct readNetFromDarknetWorker : public CatchCvExceptionWorker{
  public:
    std::string cfgFile;
    std::string darknetModelFile = "";

    cv::dnn::Net net;

    std::string executeCatchCvExceptionWorker() {
      net = cv::dnn::readNetFromDarknet(cfgFile, darknetModelFile);
      if (net.empty()) {
        return std::string("failed to cfgFile: " + cfgFile + ", darknetModelFile: " + darknetModelFile).data();
      }
      return "";
    }

    v8::Local<v8::Value> getReturnValue() {
      return Net::Converter::wrap(net);
    }

    bool unwrapRequiredArgs(Nan::NAN_METHOD_ARGS_TYPE info) {
      return (
          StringConverter::arg(0, &cfgFile, info));
    }

    bool unwrapOptionalArgs(Nan::NAN_METHOD_ARGS_TYPE info) {
      return (
          StringConverter::optArg(1, &darknetModelFile, info));
    }
  };

  struct ReadNetFromTensorflowWorker : public CatchCvExceptionWorker {
  public:
    std::string modelFile;
    std::string configFile = "";

    cv::dnn::Net net;

    std::string executeCatchCvExceptionWorker() {
      net = cv::dnn::readNetFromTensorflow(modelFile, configFile);
      if (net.empty()) {
        return std::string("failed to load net: " + modelFile + "failed to load config: " + configFile).data();
      }
      return "";
    }

    v8::Local<v8::Value> getReturnValue() {
      return Net::Converter::wrap(net);<commit_msg>Add directive for opencv3.3.0 build<commit_after>#include "dnn.h"

#ifndef __FF_DNNBINDINGS_H_
#define __FF_DNNBINDINGS_H_

namespace DnnBindings {

  struct readNetFromDarknetWorker : public CatchCvExceptionWorker{
  public:
    std::string cfgFile;
    std::string darknetModelFile = "";

    cv::dnn::Net net;

    std::string executeCatchCvExceptionWorker() {
      net = cv::dnn::readNetFromDarknet(cfgFile, darknetModelFile);
      if (net.empty()) {
        return std::string("failed to cfgFile: " + cfgFile + ", darknetModelFile: " + darknetModelFile).data();
      }
      return "";
    }

    v8::Local<v8::Value> getReturnValue() {
      return Net::Converter::wrap(net);
    }

    bool unwrapRequiredArgs(Nan::NAN_METHOD_ARGS_TYPE info) {
      return (
          StringConverter::arg(0, &cfgFile, info));
    }

    bool unwrapOptionalArgs(Nan::NAN_METHOD_ARGS_TYPE info) {
      return (
          StringConverter::optArg(1, &darknetModelFile, info));
    }
  };

  struct ReadNetFromTensorflowWorker : public CatchCvExceptionWorker {
  public:
    std::string modelFile;
    std::string configFile = "";

    cv::dnn::Net net;

    std::string executeCatchCvExceptionWorker() {
#if CV_VERSION_MINOR > 3
      net = cv::dnn::readNetFromTensorflow(modelFile, configFile);
#else
      net = cv::dnn::readNetFromTensorflow(modelFile);
#endif
      if (net.empty()) {
        return std::string("failed to load net: " + modelFile + "failed to load config: " + configFile).data();
      }
      return "";
    }

    v8::Local<v8::Value> getReturnValue() {
      return Net::Converter::wrap(net);
{'fraction_non_alphanumeric': 0.1309255079006772, 'fraction_numerical': 0.0051596259271202835, 'mean_word_length': 3.5617647058823527, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1180203', 'n_tokens_mistral': 1025, 'n_tokens_neox': 997, 'n_words': 182}