<commit_before>{- |
 Module      :  XMonad.Actions.Search
 Copyright   :  (C) 2007 <NAME>
 License     :  None; public domain

 Maintainer  :  <<EMAIL>>
 Stability   :  unstable
 Portability :  unportable

 A module for easily running Internet searches on web sites through XMonad.
 Modeled after the handy Surfraw CLI search tools
 <https://secure.wikimedia.org/wikipedia/en/wiki/Surfraw>.

 Additional sites welcomed.
--------------------------------------------------------------------------- -}
module XMonad.Actions.Search (      -- * Usage
                                 -- $usage
                                 search,
                                 simpleEngine,
                                 promptSearch,
                                 selectSearch,

                                 amazon,
                                 google,
                                 imdb,
                                 wayback,
                                 wikipedia,
                                 hoogle
                          ) where

import Data.Char (chr, ord, isAlpha, isMark, isDigit)
import Numeric (showIntAtBase)
import XMonad (X(), MonadIO)
import XMonad.Prompt (XPrompt(showXPrompt), mkXPrompt, XPConfig())
import XMonad.Prompt.Shell (getShellCompl)
import XMonad.Util.Run (safeSpawn)
import XMonad.Util.XSelection (getSelection)

{- $usage

   This module is intended to allow easy access to databases on the Internet
   through XMonad's interface. The idea is that one wants to run a search but the
   query string and the browser to use must come from somewhere. There are two
   places the query string can come from - the user can type it into a prompt
   which pops up, or the query could be available already in the X Windows
   copy/paste buffer (perhaps you just highlighted the string of interest).

   Thus, there are two main functions: 'promptSearch', and 'selectSearch'
   (implemented using the more primitive 'search'). To each of these is passed an
   engine function; this is a function that knows how to search a particular
   site.
   For example, the 'google' function knows how to search Google, and so on. You pass
   promptSearch and selectSearch the engine you want, the browser you want, and
   anything special they might need; this whole line is then bound to a key of
   you choosing in your xmonad.hs. For specific examples, see each function.
   This module is easily extended to new sites by using 'simpleEngine'.
-}

-- A customized prompt.
data Search = Search
instance XPrompt Search where
    showXPrompt Search = "Search: "<commit_msg>XMonad.Actions.Search: haddock fix<commit_after>{- |
 Module      :  XMonad.Actions.Search
 Copyright   :  (C) 2007 <NAME>
 License     :  None; public domain

 Maintainer  :  <<EMAIL>>
 Stability   :  unstable
 Portability :  unportable

 A module for easily running Internet searches on web sites through XMonad.
 Modeled after the handy Surfraw CLI search tools
 <https://secure.wikimedia.org/wikipedia/en/wiki/Surfraw>.

 Additional sites welcomed.
--------------------------------------------------------------------------- -}
module XMonad.Actions.Search (      -- * Usage
                                 -- $usage
                                 search,
                                 simpleEngine,
                                 promptSearch,
                                 selectSearch,

                                 amazon,
                                 google,
                                 imdb,
                                 wayback,
                                 wikipedia,
                                 hoogle
                          ) where

import Data.Char (chr, ord, isAlpha, isMark, isDigit)
import Numeric (showIntAtBase)
import XMonad (X(), MonadIO)
import XMonad.Prompt (XPrompt(showXPrompt), mkXPrompt, XPConfig())
import XMonad.Prompt.Shell (getShellCompl)
import XMonad.Util.Run (safeSpawn)
import XMonad.Util.XSelection (getSelection)

{- $usage

   This module is intended to allow easy access to databases on the Internet
   through XMonad's interface. The idea is that one wants to run a search but the
   query string and the browser to use must come from somewhere. There are two
   places the query string can come from - the user can type it into a prompt
   which pops up, or the query could be available already in the X Windows
   copy\/paste buffer (perhaps you just highlighted the string of interest).

   Thus, there are two main functions: 'promptSearch', and 'selectSearch'
   (implemented using the more primitive 'search'). To each of these is passed an
   engine function; this is a function that knows how to search a particular
   site.
   For example, the 'google' function knows how to search Google, and so on. You pass
   promptSearch and selectSearch the engine you want, the browser you want, and
   anything special they might need; this whole line is then bound to a key of
   you choosing in your xmonad.hs. For specific examples, see each function.
   This module is easily extended to new sites by using 'simpleEngine'.
-}

-- A customized prompt.
data Search = Search
instance XPrompt Search where
    showXPrompt Search = "Search: "
{'fraction_non_alphanumeric': 0.08464189965530448, 'fraction_numerical': 0.0015319800842589046, 'mean_word_length': 1.8856353591160222, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 22, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5251923', 'n_tokens_mistral': 1291, 'n_tokens_neox': 1239, 'n_words': 560}