Commit 5fbdca4a authored by James Laver's avatar James Laver

Add more interesting ngrams table test data

parent b07cf49c
...@@ -5,7 +5,9 @@ import Data.Argonaut (class DecodeJson, class EncodeJson, decodeJson, jsonEmptyO ...@@ -5,7 +5,9 @@ import Data.Argonaut (class DecodeJson, class EncodeJson, decodeJson, jsonEmptyO
import Data.Generic.Rep (class Generic) import Data.Generic.Rep (class Generic)
import Data.Lens (Lens', lens, (?~)) import Data.Lens (Lens', lens, (?~))
import Data.Generic.Rep.Show (genericShow) import Data.Generic.Rep.Show (genericShow)
import Data.Map as M import Data.Map as Map
import Data.Set as Set
import Data.Tuple (Tuple(..))
import Data.Maybe (Maybe(..), maybe) import Data.Maybe (Maybe(..), maybe)
import Data.Either (Either(..)) import Data.Either (Either(..))
import Effect.Aff (Aff) import Effect.Aff (Aff)
...@@ -20,8 +22,20 @@ import Gargantext.Prelude ...@@ -20,8 +22,20 @@ import Gargantext.Prelude
import Gargantext.Config (toUrl, NodeType(..), End(..)) import Gargantext.Config (toUrl, NodeType(..), End(..))
import Gargantext.Config.REST (get) import Gargantext.Config.REST (get)
import Gargantext.Components.Node (NodePoly(..)) import Gargantext.Components.Node (NodePoly(..))
import Gargantext.Components.NgramsTable (NgramsTable(..)) import Gargantext.Components.NgramsTable (NgramsTable(..), NgramsElement(..))
import Gargantext.Components.Annotated.AnnotatedField as AnnotatedField import Gargantext.Components.Annotated.AnnotatedField as AnnotatedField
import Gargantext.Types (TermList(..))
nge :: String -> Tuple String NgramsElement
nge word = Tuple word elem where
elem = NgramsElement
{ ngrams: word, list: CandidateTerm
, occurrences: 1, parent: Nothing
, root: Nothing, children: Set.empty }
testTable :: NgramsTable
testTable = NgramsTable $ Map.fromFoldable $ nge <$> words
where words = [ "the", "quick", "brown", "fox", "jumped", "over", "lazy", "dog" ]
type State = type State =
{ document :: Maybe (NodePoly Document) { document :: Maybe (NodePoly Document)
...@@ -34,7 +48,7 @@ initialState :: {} -> State ...@@ -34,7 +48,7 @@ initialState :: {} -> State
initialState {} = initialState {} =
{ document: Nothing { document: Nothing
, annotatedDocument: defaultAnnotatedDocument , annotatedDocument: defaultAnnotatedDocument
, ngramsTable: NgramsTable M.empty , ngramsTable: testTable
, inputValue: "" , inputValue: ""
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment