<commit_before>package main

import (
  "fmt"
  "time"
  "os"
  "strconv"

  ui "github.com/gizak/termui"
  coinApi "github.com/miguelmota/go-coinmarketcap"
  "github.com/dustin/go-humanize"
)

func FloatToString(input_num float64) string {
    // to convert a float number to a string
    return strconv.FormatFloat(input_num, 'f', 6, 64)
}

func Render(coin string, dateRange string) {
  if coin == "" {
    coin = "bitcoin"
  }

  if dateRange == "" {
    dateRange = "7d"
  }

  var (
    oneMinute int64 = 60
    oneHour int64 = oneMinute * 60
    oneDay int64 = oneHour * 24
    oneMonth int64 = oneDay * 30
    oneYear int64 = oneDay * 365
  )

  now := time.Now()
  secs := now.Unix()
  start := secs - oneDay
  end := secs

  dateNumber, err := strconv.ParseInt(dateRange[0:len(dateRange)-1], 10, 64)

  if err != nil {
    panic(err)
  }

  dateType := dateRange[len(dateRange)-1:]

  if dateType == "n" {
    start = secs - (oneMinute * dateNumber)
  } else if dateType == "h" {
    start = secs - (oneHour * dateNumber)
  } else if dateType == "d" {
    start = secs - (oneDay * dateNumber)
  } else if dateType == "m" {
    start = secs - (oneMonth * dateNumber)
  } else if dateRange == "y" {
    start = secs - (oneYear * dateNumber)
  }

  coinInfo, err := coinApi.GetCoinData(coin)<commit_msg>weeks<commit_after>package main

import (
  "fmt"
  "time"
  "os"
  "strconv"

  ui "github.com/gizak/termui"
  coinApi "github.com/miguelmota/go-coinmarketcap"
  "github.com/dustin/go-humanize"
)

func FloatToString(input_num float64) string {
    // to convert a float number to a string
    return strconv.FormatFloat(input_num, 'f', 6, 64)
}

func Render(coin string, dateRange string) {
  if coin == "" {
    coin = "bitcoin"
  }

  if dateRange == "" {
    dateRange = "7d"
  }

  var (
    oneMinute int64 = 60
    oneHour int64 = oneMinute * 60
    oneDay int64 = oneHour * 24
    oneWeek int64 = oneDay * 7
    oneMonth int64 = oneDay * 30
    oneYear int64 = oneDay * 365
  )

  now := time.Now()
  secs := now.Unix()
  start := secs - oneDay
  end := secs

  dateNumber, err := strconv.ParseInt(dateRange[0:len(dateRange)-1], 10, 64)

  if err != nil {
    panic(err)
  }

  dateType := dateRange[len(dateRange)-1:]

  if dateType == "n" {
    start = secs - (oneMinute * dateNumber)
  } else if dateType == "h" {
    start = secs - (oneHour * dateNumber)
  } else if dateType == "d" {
    start = secs - (oneDay * dateNumber)
  } else if dateType == "w" {
    start = secs - (oneWeek * dateNumber)
  } else if dateType == "m" {
    start = secs - (oneMonth * dateNumber)
  } else if dateRange == "y" {
    start = secs - (oneYear * dateNumber)
  }

  coinInfo, err := coinApi.GetCoinData(coin)
{'fraction_non_alphanumeric': 0.13812154696132597, 'fraction_numerical': 0.02615101289134438, 'mean_word_length': 2.7617728531855956, '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': '3578973', 'n_tokens_mistral': 1095, 'n_tokens_neox': 1024, 'n_words': 259}