<commit_before>{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE TemplateHaskell #-}

module Types.Agent.Intelligent.Filter where

import Data.Graph
import qualified Data.Map as M
import qualified Data.Set as S

-- |A condition for the firing of a node.
data NodeCondition a =
   NodeEQ a
   | NodeGT a
   | NodeLT a
   -- These combinators are commented out under the assumption that
   -- the complexity of the detection will lie in the graph structure and
   -- that each emotion should be "primitive" in the following sense:
   -- emotions should be triggered only by positive stimuli, not by negative
   -- ones, obviating the need for a NOT.
   -- | NodeAnd (NodeCondition a) (NodeCondition a)
   -- | NodeOr (NodeCondition a) (NodeCondition a)
   -- | NodeNot (NodeCondition a)

data FilterNode = FN {
   _filterNodeCondition :: NodeCondition Int,
   _filterNodeExcitement :: Int,
   _filterNodeTreshold :: Int
   }

data Filter a = FI {
   _filterGraph :: Graph,
   _filterEdgeStrength :: M.Map Edge Rational,
   _filterOutputNodes :: S.Set Vertex,
   _filterNodeInfo :: M.Map Vertex FilterNode
}<commit_msg>Changed the types in Types/Agent/Intelligent/Filter.hs<commit_after>{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE TemplateHaskell #-}

module Types.Agent.Intelligent.Filter where

import Data.Graph
import qualified Data.Map as M

type NodeSignificance = Int

-- |A condition for the firing of a node.
data NodeCondition a =
   -- |\"Equal to x\".
   NodeEQ a
   -- |\"Greater than (or equal to) x\" (i.e. @(NodeGT x) y <=> x <= y@).
   | NodeGT a
   -- |The reverse of 'NodeGT' (but not its negation).
   | NodeLT a
   -- These combinators are commented out under the assumption that
   -- the complexity of the detection will lie in the graph structure and
   -- that each emotion should be "primitive" in the following sense:
   -- emotions should be triggered only by positive stimuli, not by negative
   -- ones, obviating the need for a NOT.
   -- | NodeAnd (NodeCondition a) (NodeCondition a)
   -- | NodeOr (NodeCondition a) (NodeCondition a)
   -- | NodeNot (NodeCondition a)

data FilterNode a = FN {
   _filterNodeCondition :: NodeCondition a,
   _filterNodeExcitement :: Int,
   _filterNodeTreshold :: Int,
   _filterNodeExcitementInc :: Int,
   _filterNodeActive :: Bool
   }

data Filter a = FI {
   _filterGraph :: Graph,
   _filterEdgeStrength :: M.Map Edge Rational,
   _filterOutputNodes :: M.Map Vertex NodeSignificance,
   _filterNodeInfo :: M.Map Vertex (FilterNode a)
}
{'fraction_non_alphanumeric': 0.09889705882352941, 'fraction_numerical': 0.0, 'mean_word_length': 3.4388254486133767, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 4, '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': '5607960', 'n_tokens_mistral': 851, 'n_tokens_neox': 828, 'n_words': 296}