<commit_before>package jp.toastkid.search

import android.net.Uri
import android.webkit.URLUtil
import androidx.annotation.DrawableRes
import androidx.annotation.StringRes
import androidx.core.net.toUri
import java.util.Locale

/**
 * Web search category.
 *
 * @author toastkidjp
 */
enum class SearchCategory(
        @StringRes val id: Int,
        @DrawableRes val iconId: Int,
        private val host: String,
        private val generator: (l: String, h: String, q: String) -> String = { _, h, q ->  h + q }
) {
    GOOGLE(
            R.string.google,
            R.drawable.ic_google,
            "https://www.google.com/search?q="
    ),
    YAHOO(
            R.string.search_category_yahoo,
            R.drawable.ic_yahoo,
            "https://search.yahoo.com/search?p="
    ),
    YAHOO_JAPAN_REALTIME_SEARCH(
            R.string.search_category_yahoo_japan_realtime_search,
            R.drawable.ic_yahoo_japan_realtime_search,<commit_msg>bugfix #412 Encode search word.<commit_after>package jp.toastkid.search

import android.net.Uri
import android.webkit.URLUtil
import androidx.annotation.DrawableRes
import androidx.annotation.StringRes
import androidx.core.net.toUri
import java.util.Locale

/**
 * Web search category.
 *
 * @author toastkidjp
 */
enum class SearchCategory(
        @StringRes val id: Int,
        @DrawableRes val iconId: Int,
        private val host: String,
        private val generator: (l: String, h: String, q: String) -> String = { _, h, q ->  h + Uri.encode(q) }
) {
    GOOGLE(
            R.string.google,
            R.drawable.ic_google,
            "https://www.google.com/search?q="
    ),
    YAHOO(
            R.string.search_category_yahoo,
            R.drawable.ic_yahoo,
            "https://search.yahoo.com/search?p="
    ),
    YAHOO_JAPAN_REALTIME_SEARCH(
            R.string.search_category_yahoo_japan_realtime_search,
            R.drawable.ic_yahoo_japan_realtime_search,
{'fraction_non_alphanumeric': 0.10751028806584362, 'fraction_numerical': 0.0015432098765432098, 'mean_word_length': 2.5428051001821492, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, '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': '7586965', 'n_tokens_mistral': 650, 'n_tokens_neox': 620, 'n_words': 121}