<commit_before>/*
Package swetest is the simple wrapper of swisseph library's swetest.

Swetest:
 test page: http://www.astro.com/swisseph/swetest.htm
 Help: http://www.astro.com/cgi/swetest.cgi?arg=-h&p=0
 ephemeris files: ftp://ftp.astro.com/pub/swisseph/ephe/

Example:
	package main

	import (
		"fmt"
		"log"

		"github.com/DestinyLab/go-swetest"
	)

	func main() {
		opt := []string{
			"-edir./resources/",
			"-b11.11.2017",
			"-ut00:00:00",
			"-p0",
			"-fZ",
			"-eswe",
			"-head",
		}
		s := swetest.New()
		res, err := s.Query(opt)
		if err != nil {
			log.Fatal(err)
		}
		fmt.Printf("%s", res)
	}
*/
package swetest

import (
	"os/exec"
	"path/filepath"
	"runtime"
)

// A Swetest returns what you queryed to swisseph library's swetest.
type Swetest struct {
	binPath string
}

// New creates an instance of swetest.
func New() *Swetest {
	return &Swetest{binPath: getDefaultBinPath()}
}

// SetBinPath set the path to swetest(executable binary).
func (s *Swetest) SetBinPath(p string) {
	s.binPath = p
}

// Query query what you want.
func (s *Swetest) Query(q []string) ([]byte, error) {
	return exec.Command(s.binPath+"swetest", q[0:]...).Output()
}

func getDefaultBinPath() string {
	_, file, _, _ := runtime.Caller(0)

	return filepath.Dir(file)
}
<commit_msg>fix path<commit_after>/*
Package swetest is the simple wrapper of swisseph library's swetest.

Swetest:
 test page: http://www.astro.com/swisseph/swetest.htm
 Help: http://www.astro.com/cgi/swetest.cgi?arg=-h&p=0
 ephemeris files: ftp://ftp.astro.com/pub/swisseph/ephe/

Example:
	package main

	import (
		"fmt"
		"log"

		"github.com/DestinyLab/go-swetest"
	)

	func main() {
		opt := []string{
			"-edir./resources/",
			"-b11.11.2017",
			"-ut00:00:00",
			"-p0",
			"-fZ",
			"-eswe",
			"-head",
		}
		s := swetest.New()
		res, err := s.Query(opt)
		if err != nil {
			log.Fatal(err)
		}
		fmt.Printf("%s", res)
	}
*/
package swetest

import (
	"os/exec"
	"path/filepath"
	"runtime"
)

// A Swetest returns what you queryed to swisseph library's swetest.
type Swetest struct {
	binPath string
}

// New creates an instance of swetest.
func New() *Swetest {
	return &Swetest{binPath: getDefaultBinPath()}
}

// SetBinPath set the path to swetest(executable binary).
func (s *Swetest) SetBinPath(p string) {
	s.binPath = p
}

// Query query what you want.
func (s *Swetest) Query(q []string) ([]byte, error) {
	return exec.Command(s.binPath+"/swetest", q[0:]...).Output()
}

func getDefaultBinPath() string {
	_, file, _, _ := runtime.Caller(0)

	return filepath.Dir(file)
}

{'fraction_non_alphanumeric': 0.17135050741608118, 'fraction_numerical': 0.01405152224824356, 'mean_word_length': 3.3514431239388793, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '5026099', 'n_tokens_mistral': 1145, 'n_tokens_neox': 1038, 'n_words': 237}