<commit_before>package sofa

import (
	"net/url"
	"strings"
)

// FutonURL attempts to correctly convert any CouchDB path into a URL to be used to
// access the same documents through the Futon web GUI.
func (con *Connection) FutonURL(path string) url.URL {
	patharr := strings.Split(strings.Trim(path, "/"), "/")

	furl := con.URL("/")
	furl.Path = urlConcat(furl.Path, "_utils/")

	if len(patharr) == 0 || patharr[0] == "" {
		return furl
	}

	isDatabaseURL := false
	if len(patharr) == 1 {
		isDatabaseURL = true
	} else {
		switch patharr[1] {
		case "_design", "_all_docs":
			isDatabaseURL = true
		}
	}

	furl.RawQuery = strings.TrimLeft(path, "/")

	if isDatabaseURL {
		furl.Path = urlConcat(furl.Path, "database.html")
		return furl
	}

	furl.Path = urlConcat(furl.Path, "document.html")
	return furl
}<commit_msg>Add a utility function for converting booleans<commit_after>package sofa

import (
	"net/url"
	"strings"
)

// FutonURL attempts to correctly convert any CouchDB path into a URL to be used to
// access the same documents through the Futon web GUI.
func (con *Connection) FutonURL(path string) url.URL {
	patharr := strings.Split(strings.Trim(path, "/"), "/")

	furl := con.URL("/")
	furl.Path = urlConcat(furl.Path, "_utils/")

	if len(patharr) == 0 || patharr[0] == "" {
		return furl
	}

	isDatabaseURL := false
	if len(patharr) == 1 {
		isDatabaseURL = true
	} else {
		switch patharr[1] {
		case "_design", "_all_docs":
			isDatabaseURL = true
		}
	}

	furl.RawQuery = strings.TrimLeft(path, "/")

	if isDatabaseURL {
		furl.Path = urlConcat(furl.Path, "database.html")
		return furl
	}

	furl.Path = urlConcat(furl.Path, "document.html")
	return furl
}

func Boolean(b bool) BooleanParameter {
	if b {
		return True
	}

	return False
}
{'fraction_non_alphanumeric': 0.14058956916099774, 'fraction_numerical': 0.0045351473922902496, 'mean_word_length': 3.6693121693121693, 'pattern_counts': {'":': 2, '<': 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': '5838879', 'n_tokens_mistral': 683, 'n_tokens_neox': 638, 'n_words': 170}