<commit_before>package com.ldaniels528.trifecta

import java.io.PrintStream

import com.ldaniels528.trifecta.TxConsole._
import com.ldaniels528.trifecta.command.Command
import com.ldaniels528.trifecta.vscript.Scope
import org.apache.zookeeper.KeeperException.ConnectionLossException
import org.fusesource.jansi.Ansi.Color._

import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future
import scala.concurrent.duration._
import scala.language.postfixOps
import scala.util.{Failure, Success, Try}

/**
 * Trifecta Console Shell Application
 * @author <NAME> <<EMAIL>>
 */
class TrifectaShell(config: TxConfig, rt: TxRuntimeContext) {
  private implicit val scope: Scope = config.scope

  // redirect standard output
  val out: PrintStream = rt.config.out
  val err: PrintStream = rt.config.err

  // load the history, then schedule session history file updates
  val history: History = SessionManagement.history
  history.load(TxConfig.historyFile)
  SessionManagement.setupHistoryUpdates(TxConfig.historyFile, 60 seconds)

  // load the commands from the modules
  private def commandSet: Map[String, Command] = rt.moduleManager.commandSet

  // make sure we shutdown the ZooKeeper connection
  Runtime.getRuntime.addShutdownHook(new Thread {
    override def run() {
      // shutdown the ZooKeeper instance
      rt.shutdown()

      // close each module
      rt.moduleManager.shutdown()
    }
  })

  /**
   * Executes the given command line expression
   * @param line the given command line expression
   */<commit_msg>removed unused code<commit_after>package com.ldaniels528.trifecta

import java.io.PrintStream

import com.ldaniels528.trifecta.TxConsole._
import com.ldaniels528.trifecta.vscript.Scope
import org.apache.zookeeper.KeeperException.ConnectionLossException
import org.fusesource.jansi.Ansi.Color._

import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future
import scala.concurrent.duration._
import scala.language.postfixOps
import scala.util.{Failure, Success, Try}

/**
 * Trifecta Console Shell Application
 * @author <NAME> <<EMAIL>>
 */
class TrifectaShell(config: TxConfig, rt: TxRuntimeContext) {
  private implicit val scope: Scope = config.scope

  // redirect standard output
  val out: PrintStream = rt.config.out
  val err: PrintStream = rt.config.err

  // load the history, then schedule session history file updates
  val history: History = SessionManagement.history
  history.load(TxConfig.historyFile)
  SessionManagement.setupHistoryUpdates(TxConfig.historyFile, 60 seconds)

  // make sure we shutdown the ZooKeeper connection
  Runtime.getRuntime.addShutdownHook(new Thread {
    override def run() {
      // shutdown the ZooKeeper instance
      rt.shutdown()

      // close each module
      rt.moduleManager.shutdown()
    }
  })

  /**
   * Executes the given command line expression
   * @param line the given command line expression
   */
{'fraction_non_alphanumeric': 0.08587915818058384, 'fraction_numerical': 0.008486082824168364, 'mean_word_length': 4.2437722419928825, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '4151703', 'n_tokens_mistral': 897, 'n_tokens_neox': 854, 'n_words': 224}