<commit_before>module.exports = {
  geonames: {
    baseUrl: 'http://sws.geonames.org/',

    URLtoURN: function(url) {
      var match = /.*?(\d+).*/.exec(url);
      return 'urn:geonames:' + match[1];
    },

    URNtoURL: function(nid, nss) {
      return this.baseUrl + nss + '/';
    }
  },
  tgn: {
    baseUrl: 'http://vocab.getty.edu/tgn/',

    URLtoURN: function(url) {
      var match = /.*?(term)?\/?(\d+).*/.exec(url);
      var nss = [match[1], match[2]].filter(function(part) { return part; }).join(':');
      return 'urn:tgn:' + nss;
    },

    URNtoURL: function(nid, nss) {
      return this.baseUrl + nss.split(':').join('/');
    }
  }
};
<commit_msg>use nss:hg:x<commit_after>var u = require('util');

function prefix(nid) {
  return u.format('urn:hg:%s:', nid)
}

module.exports = {
  geonames: {
    baseUrl: 'http://sws.geonames.org/',

    URLtoURN: function(url) {
      var match = /.*?(\d+).*/.exec(url);
      return prefix('geonames') + match[1];
    },

    URNtoURL: function(nid, nss) {
      return this.baseUrl + nss + '/';
    }
  },
  tgn: {
    baseUrl: 'http://vocab.getty.edu/tgn/',

    URLtoURN: function(url) {
      var match = /.*?(term)?\/?(\d+).*/.exec(url);
      var nss = [match[1], match[2]].filter(function(part) { return part; }).join(':');
      return prefix('tgn') + nss;
    },

    URNtoURL: function(nid, nss) {
      return this.baseUrl + nss.split(':').join('/');
    }
  }
};

{'fraction_non_alphanumeric': 0.23333333333333334, 'fraction_numerical': 0.004166666666666667, 'mean_word_length': 2.531862745098039, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5849042', 'n_tokens_mistral': 592, 'n_tokens_neox': 573, 'n_words': 93}