<commit_before>// The MIT License (MIT)
//
// Copyright (c) 2015 <NAME>
//
// See LICENSE file.
package search

import (
	"encoding/json"
	"fmt"
	"github.com/romainletendart/goxxx/core"
	"github.com/thoj/go-ircevent"
	"io/ioutil"
	"log"
	"net/http"
	"regexp"
	"strings"
)

//  --- --- --- Constants --- --- ---
const (
	URL_DUCKDUCKGO       string = "https://duckduckgo.com/html/?q=%s"
	URL_WIKIPEDIA        string = "https://%s.wikipedia.org/w/api.php?format=json&action=query&prop=extracts|info&exintro=&explaintext=&inprop=url&titles=%s"
	URL_URBANDICTIONNARY string = "http://api.urbandictionary.com/v0/define?term=%s"

	HELP_DUCKDUCKGO       string = "!d/!dg/!ddg <terms to search> \t=> Search on DuckduckGo"
	HELP_WIKIPEDIA        string = "!w <terms to search> \t\t\t=> Search on Wikipedia EN"
	HELP_WIKIPEDIA_FR     string = "!wf <terms to search> \t\t\t=> Search on Wikipedia FR"
	HELP_URBANDICTIONNARY string = "!u/!ud <terms to search> \t\t=> Search on Urban Dictionnary"
)

// --- --- --- Types  --- --- ---
type wikipedia struct {
	Query struct {
		Pages map[string]struct {
			Extract string `json:"extract"`
			Fullurl string `json:"fullurl"`
			Title   string `json:"title"`
		} `json:"pages"`
	} `json:"query"`
}

type urbanDictionnary struct {
	List []struct {
		Definition string `json:"definition"`
		Example    string `json:"example"`
		Permalink  string `json:"permalink"`
	} `json:"list"`
}

type searchData struct {
	getUrl         func(string, string) []string
	extraParameter string
	// First string is for the first result (URL), second string for the second result (Details/Definition/...)
	text_result    [2]string
	text_no_result string
}

// --- --- --- Global variable --- --- ---<commit_msg>Search: Updated help message for wikipedia FR<commit_after>// The MIT License (MIT)
//
// Copyright (c) 2015 <NAME>
//
// See LICENSE file.
package search

import (
	"encoding/json"
	"fmt"
	"github.com/romainletendart/goxxx/core"
	"github.com/thoj/go-ircevent"
	"io/ioutil"
	"log"
	"net/http"
	"regexp"
	"strings"
)

//  --- --- --- Constants --- --- ---
const (
	URL_DUCKDUCKGO       string = "https://duckduckgo.com/html/?q=%s"
	URL_WIKIPEDIA        string = "https://%s.wikipedia.org/w/api.php?format=json&action=query&prop=extracts|info&exintro=&explaintext=&inprop=url&titles=%s"
	URL_URBANDICTIONNARY string = "http://api.urbandictionary.com/v0/define?term=%s"

	HELP_DUCKDUCKGO       string = "!d/!dg/!ddg <terms to search> \t=> Search on DuckduckGo"
	HELP_WIKIPEDIA        string = "!w <terms to search> \t\t\t=> Search on Wikipedia EN"
	HELP_WIKIPEDIA_FR     string = "!wf/!wfr <terms to search> \t\t\t=> Search on Wikipedia FR"
	HELP_URBANDICTIONNARY string = "!u/!ud <terms to search> \t\t=> Search on Urban Dictionnary"
)

// --- --- --- Types  --- --- ---
type wikipedia struct {
	Query struct {
		Pages map[string]struct {
			Extract string `json:"extract"`
			Fullurl string `json:"fullurl"`
			Title   string `json:"title"`
		} `json:"pages"`
	} `json:"query"`
}

type urbanDictionnary struct {
	List []struct {
		Definition string `json:"definition"`
		Example    string `json:"example"`
		Permalink  string `json:"permalink"`
	} `json:"list"`
}

type searchData struct {
	getUrl         func(string, string) []string
	extraParameter string
	// First string is for the first result (URL), second string for the second result (Details/Definition/...)
	text_result    [2]string
	text_no_result string
}

// --- --- --- Global variable --- --- ---
{'fraction_non_alphanumeric': 0.16901004304160688, 'fraction_numerical': 0.003443328550932568, 'mean_word_length': 3.2203389830508473, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 21, 'https://': 4, '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': '300930', 'n_tokens_mistral': 1326, 'n_tokens_neox': 1264, 'n_words': 290}