<commit_before>package main

import (
	"encoding/json"
	"fmt"
	"nli-go/lib/common"
	"nli-go/lib/global"
	"os"
)

type Result struct {
	Error      bool
	ErrorLines []string
	Value      []string
}

// This application takes a sentence as its parameter and executes a given command.
func main() {

	if len(os.Args) != 4 {
		fmt.Println("Usage: nli <command> </path/to/config.json> <full sentence>")
		fmt.Println("")
		fmt.Println("Example:")
		fmt.Println("    nli answer fox/config.json \"Did the quick brown jump over the lazy dog?\"")
		fmt.Println("")
		fmt.Println("Commands:")
		fmt.Println("    answer     Return an answer to <full sentence>")
		fmt.Println("    suggest    Returns next word suggestions")
		return
	}

	command := os.Args[1]
	configPath := os.Args[2]
	sentence := os.Args[3]

	path := configPath
	if len(path) > 0 && path[0] != os.PathSeparator {
		path = common.Dir() + string(os.PathSeparator) + configPath
	}

	log := global.NewSystemLog()
	system := global.NewSystem(path, log)

	ok := log.IsOk()
	value := []string{}
	errorLines := []string{}

	if ok {
		switch command {
		case "answer":
			value = []string{system.Answer(sentence)}
		case "suggest":
			value = system.Suggest(sentence)
		default:
			errorLines = []string{fmt.Sprintf("%s is not valid command.\n", os.Args[1])}
			ok = false
		}
	}

	if !log.IsOk() {
		errorLines = append(errorLines, log.GetLogLines()...)
	}

	result := Result{
		Error:      !ok,
		ErrorLines: errorLines,
		Value:      value,
	}

	jsonString, _ := json.Marshal(result)
	fmt.Printf(string(jsonString))

	if !ok {
		os.Exit(1)
	}
}
<commit_msg>Fix nli command<commit_after>package main

import (
	"encoding/json"
	"fmt"
	"nli-go/lib/common"
	"nli-go/lib/global"
	"os"
)

type Result struct {
	Error      bool
	ErrorLines []string
	Value      []string
}

// This application takes a sentence as its parameter and executes a given command.
func main() {

	if len(os.Args) != 4 {
		fmt.Println("Usage: nli <command> </path/to/config.json> <full sentence>")
		fmt.Println("")
		fmt.Println("Example:")
		fmt.Println("    nli answer fox/config.json \"Did the quick brown jump over the lazy dog?\"")
		fmt.Println("")
		fmt.Println("Commands:")
		fmt.Println("    answer     Return an answer to <full sentence>")
		fmt.Println("    suggest    Returns next word suggestions")
		return
	}

	command := os.Args[1]
	configPath := os.Args[2]
	sentence := os.Args[3]

	path := configPath
	if len(path) > 0 && path[0] != os.PathSeparator {
		path = common.Dir() + string(os.PathSeparator) + configPath
	}

	log := common.NewSystemLog(false)
	system := global.NewSystem(path, log)

	value := []string{}
	errorLines := []string{}

	if log.IsOk() {
		switch command {
		case "answer":
			value = []string{system.Answer(sentence)}
		case "suggest":
			value = system.Suggest(sentence)
		default:
			errorLines = []string{fmt.Sprintf("%s is not valid command.\n", os.Args[1])}
		}
	}

	if !log.IsOk() {
		errorLines = append(errorLines, log.GetDebugLines()...)
	}

	result := Result{
		Error:      !log.IsOk(),
		ErrorLines: errorLines,
		Value:      value,
	}

	jsonString, _ := json.Marshal(result)
	fmt.Printf(string(jsonString))

	if !log.IsOk() {
		os.Exit(1)
	}
}

{'fraction_non_alphanumeric': 0.15956454121306377, 'fraction_numerical': 0.004976671850699844, 'mean_word_length': 3.399452804377565, 'pattern_counts': {'":': 4, '<': 11, '<?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': '7340316', 'n_tokens_mistral': 1229, 'n_tokens_neox': 1144, 'n_words': 282}