<commit_before>
module.exports = prompt

var log = require("./log")
  , buffer = ""
  , stdio = process.binding("stdio")

function prompt (p, def, silent, cb) {
  if (!cb) cb = silent, silent = false
  if (!cb) cb = def, def = undefined
  if (def) p += "("+(silent ? "<hidden>" : def)+") "
  process.stdout.write(p)
  process.stdout.flush()

  return (silent) ? silentRead(def, cb) : read(def, cb)
}

function read (def, cb) {
  var stdin = process.openStdin()
    , val = ""
  stdin.resume()
  stdin.setEncoding("utf8")
  stdin.on("error", cb)
  stdin.on("data", function D (chunk) {
    val += buffer + chunk
    buffer = ""
    if (val.indexOf("\n") !== -1) {
      buffer = val.substr(val.indexOf("\n"))<commit_msg>Handle multiple \n's a bit better.<commit_after>
module.exports = prompt

var log = require("./log")
  , buffer = ""
  , stdio = process.binding("stdio")

function prompt (p, def, silent, cb) {
  if (!cb) cb = silent, silent = false
  if (!cb) cb = def, def = undefined
  if (def) p += "("+(silent ? "<hidden>" : def)+") "
  process.stdout.write(p)
  process.stdout.flush()

  return (silent) ? silentRead(def, cb) : read(def, cb)
}

function read (def, cb) {
  var stdin = process.openStdin()
    , val = ""
  stdin.resume()
  stdin.setEncoding("utf8")
  stdin.on("error", cb)
  stdin.on("data", function D (chunk) {
    val += buffer + chunk
    buffer = ""
    if (val.indexOf("\n") !== -1) {
      if (val !== "\n") val = val.replace(/^\n+/, "")
      buffer = val.substr(val.indexOf("\n"))
{'fraction_non_alphanumeric': 0.20423000660938534, 'fraction_numerical': 0.0026437541308658294, 'mean_word_length': 3.1707988980716255, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5353096', 'n_tokens_mistral': 551, 'n_tokens_neox': 547, 'n_words': 141}