<commit_before>"use strict";

var Converter = null;
var Converter = require("substance-converter");
var NLMImporter = Converter.NLMImporter;

var LensImporter = function() {
};

LensImporter.Prototype = function() {

  // Overridden to create a Lens Article instance
  this.createDocument = function() {
    var Article = require("lens-article");
    var doc = new Article();
    return doc;
  };

};

LensImporter.Prototype.prototype = NLMImporter.prototype;
LensImporter.prototype = new LensImporter.Prototype();

module.exports = {<commit_msg>Initial work on client-side Lens Converter.<commit_after>"use strict";

var Converter = null;
var Converter = require("substance-converter");
var NLMImporter = Converter.NLMImporter;

var LensImporter = function() {

  this.viewMappings = {
    "table": "figures",
    "image": "figures",
    "figure": "figures",
    "video": "figures",
    "mixed_citation": "citations",
    "article_citation": "citations",
  };
};

LensImporter.Prototype = function() {

  // Overridden to create a Lens Article instance
  this.createDocument = function() {
    var Article = require("lens-article");
    var doc = new Article();
    return doc;
  };

  // This is called for top-level nodes which should be added to a view
  // TODO: this is experimental, and needs some experience from developing a more complex converter (e.g., for lens)
  this.show = function(state, nodes) {
    var doc = state.doc;
    
    // Defaults to content
    function getView(viewName) {
      return doc.get(viewName || "content").nodes;
    }

    // show the created nodes in the content view
    for (var j = 0; j < nodes.length; j++) {
      var node = nodes[j];
      var view = getView(this.viewMappings[node.type]);

      view.push(node.id);
    }
  };
};

LensImporter.Prototype.prototype = NLMImporter.prototype;
LensImporter.prototype = new LensImporter.Prototype();

module.exports = {
{'fraction_non_alphanumeric': 0.12702561421850497, 'fraction_numerical': 0.0005227391531625719, 'mean_word_length': 3.6009615384615383, 'pattern_counts': {'":': 6, '<': 4, '<?xml version=': 0, '>': 3, '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': '315807', 'n_tokens_mistral': 600, 'n_tokens_neox': 586, 'n_words': 164}