<commit_before># GetHandler
# =======
#
# **GetHandler** is responsible for handling all incoming GET requests.
# It responds with the JSON informatio as defined in
# ```server.XXX.json['paths']['jsonPath']/req.originalUrl/info.json``` file
# This means a GET request to /segmentation/textline/hist will return the JSON information in the file
# /data/json/segmentation/textline/hist/info.json.
#
# Copyright &copy; <NAME>, GPL v3.0 licensed.
fs          = require 'fs'
nconf       = require 'nconf'
Statistics  = require '../statistics/statistics'
#Expose getHandler
getHandler = exports = module.exports = class GetHandler

  # ---
  # **handleRequest**</br>
  # Handle incoming GET requests</br>
  # `params`
  #   *req* the incoming request
  handleRequest: (req, callback) ->
    fs.readFile nconf.get('paths:jsonPath') + req.originalUrl + '/info.json', 'utf8', (err, data) ->
      if err
        callback err
      else
        data = JSON.parse data
        data['info']['expectedRuntime'] = Statistics.getMeanExecutionTime req.originalUrl
        callback null, data
      return
    return<commit_msg>bugfix in adding runtime information<commit_after># GetHandler
# =======
#
# **GetHandler** is responsible for handling all incoming GET requests.
# It responds with the JSON informatio as defined in
# ```server.XXX.json['paths']['jsonPath']/req.originalUrl/info.json``` file
# This means a GET request to /segmentation/textline/hist will return the JSON information in the file
# /data/json/segmentation/textline/hist/info.json.
#
# Copyright &copy; <NAME>, GPL v3.0 licensed.
fs          = require 'fs'
nconf       = require 'nconf'
Statistics  = require '../statistics/statistics'
#Expose getHandler
getHandler = exports = module.exports = class GetHandler

  # ---
  # **handleRequest**</br>
  # Handle incoming GET requests</br>
  # `params`
  #   *req* the incoming request
  handleRequest: (req, callback) ->
    fs.readFile nconf.get('paths:jsonPath') + req.originalUrl + '/info.json', 'utf8', (err, data) ->
      if err
        callback err
      else
        data = JSON.parse data
        if(data['info']?)
          data['info']['expectedRuntime'] = Statistics.getMeanExecutionTime req.originalUrl
        callback null, data
      return
    return
{'fraction_non_alphanumeric': 0.1315442146942367, 'fraction_numerical': 0.0026396832380114386, 'mean_word_length': 3.373076923076923, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, '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': '94392', 'n_tokens_mistral': 667, 'n_tokens_neox': 652, 'n_words': 196}