Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
142
Issues
142
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
purescript-gargantext
Commits
f910cd90
Commit
f910cd90
authored
Feb 08, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[test] packages version bump, trying to fix ngrams test
parent
801e3852
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
1039 additions
and
1215 deletions
+1039
-1215
packages.json
.psc-package/local/.set/packages.json
+1
-1
easy-ps.nix
nix/easy-ps.nix
+1
-1
generate-packages-json.nix
nix/generate-packages-json.nix
+1
-1
purs-packages.nix
nix/purs-packages.nix
+12
-12
shell.nix
shell.nix
+12
-0
Spec.purs
test/Gargantext/Components/NgramsTable/Spec.purs
+63
-40
yarn.lock
yarn.lock
+949
-1160
No files found.
.psc-package/local/.set/packages.json
View file @
f910cd90
nix/easy-ps.nix
View file @
f910cd90
...
...
@@ -5,7 +5,7 @@ import
pkgs
.
fetchFromGitHub
{
owner
=
"justinwoo"
;
repo
=
"easy-purescript-nix"
;
rev
=
"
7ebddd8613cf6736dbecef9fce4c32f2a104ef82
"
;
rev
=
"
c8c32741bc09e2ac0a94d5140cf51fa5de809e24
"
;
sha256
=
"1g1hlybld298kimd1varvwiflpb0k7sdqlmcqha3kswjvy5z4k6k"
;
}
)
{
...
...
nix/generate-packages-json.nix
View file @
f910cd90
...
...
@@ -7,7 +7,7 @@ let
owner
=
"justinwoo"
;
repo
=
"easy-dhall-nix"
;
rev
=
"90957969850a44481c6e150350c56e8b53b29e1e"
;
sha256
=
"1
2v4ql1nm1famz8r80k1xkkdgj7285vy2vn16iili0qwvz3i98ah
"
;
sha256
=
"1
hsmp3cb0k554kh0jlfzpdzx2b8ndyh2gdykmw9hw41haaw16mmi
"
;
}
)
{
inherit
pkgs
;
...
...
nix/purs-packages.nix
View file @
f910cd90
...
...
@@ -21,11 +21,11 @@
};
"affjax"
=
{
name
=
"affjax"
;
version
=
"v1
0.1
.0"
;
version
=
"v1
1.0
.0"
;
src
=
pkgs
.
fetchgit
{
url
=
"https://github.com/slamdata/purescript-affjax.git"
;
rev
=
"v1
0.1
.0"
;
sha256
=
"
129g7x9icaqj158snzl0ilbd0dipl4bmk49is8dh8jvh0z97k700
"
;
rev
=
"v1
1.0
.0"
;
sha256
=
"
0dfwayw6h49hm5ikq6sic0yi44w8hmqx4nx5xfavqk4ary1z3ifq
"
;
};
};
"ansi"
=
{
...
...
@@ -57,11 +57,11 @@
};
"argonaut-core"
=
{
name
=
"argonaut-core"
;
version
=
"v5.
0.2
"
;
version
=
"v5.
1.0
"
;
src
=
pkgs
.
fetchgit
{
url
=
"https://github.com/purescript-contrib/purescript-argonaut-core.git"
;
rev
=
"v5.
0.2
"
;
sha256
=
"
1rfd1brvzp9akx6hypxql2qv9bhlcqks1xwqfqqf31dqvcl7vvhc
"
;
rev
=
"v5.
1.0
"
;
sha256
=
"
0x52vz5pdiamwq9cznm5mkhfcgk6raapqwdj7cmiblkflra32lhr
"
;
};
};
"argonaut-traversals"
=
{
...
...
@@ -192,11 +192,11 @@
};
"debug"
=
{
name
=
"debug"
;
version
=
"v4.0.
0
"
;
version
=
"v4.0.
1
"
;
src
=
pkgs
.
fetchgit
{
url
=
"https://github.com/garyb/purescript-debug.git"
;
rev
=
"v4.0.
0
"
;
sha256
=
"0
gwjj80akys0h111i74n429fmny992gx0r4rk1n98gqlqm5cmi21
"
;
rev
=
"v4.0.
1
"
;
sha256
=
"0
3xmchfzx7anks6b3yrrhf5b0bx7n390c814nhhxdl98936wydg4
"
;
};
};
"distributive"
=
{
...
...
@@ -651,11 +651,11 @@
};
"parsing"
=
{
name
=
"parsing"
;
version
=
"v5.
0.3
"
;
version
=
"v5.
1.0
"
;
src
=
pkgs
.
fetchgit
{
url
=
"https://github.com/purescript-contrib/purescript-parsing.git"
;
rev
=
"v5.
0.3
"
;
sha256
=
"
0m5xvb5kis28laj3navyyakyq408vw115c2dvngf1vljzh1hk5kj
"
;
rev
=
"v5.
1.0
"
;
sha256
=
"
199wjj02hh7wzkvh036vqv3369jrw1dpcb11n0nnqlqvvihfcy87
"
;
};
};
"partial"
=
{
...
...
shell.nix
View file @
f910cd90
...
...
@@ -26,6 +26,17 @@ let
yarn pulp repl
''
;
test-ps
=
pkgs
.
writeShellScriptBin
"test-ps"
''
#!/usr/bin/env bash
set -e
echo "Compiling"
build-purs
echo "Testing"
# yarn pulp browserify --skip-compile -t dist/bundle.js --src-path output
yarn pulp test --src-path output --test-path output
''
;
in
pkgs
.
mkShell
{
buildInputs
=
[
...
...
@@ -35,6 +46,7 @@ pkgs.mkShell {
build
repl
pkgs
.
yarn
test-ps
];
shellHook
=
''
...
...
test/Gargantext/Components/NgramsTable/Spec.purs
View file @
f910cd90
...
...
@@ -2,39 +2,60 @@ module Gargantext.Components.NgramsTable.Spec where
import Prelude
import Data.Maybe (Maybe(..))
import Data.Map as Map
import Data.Set as Set
import Data.Tuple (Tuple(..))
import Gargantext.Components.NgramsTable.Core (highlightNgrams, NgramsElement(..), NgramsTable(..))
import Gargantext.Types (TermList(..))
import Test.Spec (Spec, describe, it)
import Test.Spec.Assertions (shouldEqual)
-- import Test.Spec.QuickCheck (quickCheck')
import Data.Map as Map
import Data.Set as Set
{-
spec :: Spec Unit
spec = do
let ne ngrams list =
NgramsElement
{ ngrams
import Gargantext.Components.NgramsTable.Core (highlightNgrams, NgramsElement(..), NgramsRepoElement(..), NgramsTable(..), NgramsTerm, normNgram)
import Gargantext.Types (CTabNgramType(..), TermList(..))
ne :: String -> TermList -> CTabNgramType -> NgramsElement
ne ngrams list ngramType = NgramsElement { ngrams: normed
, size: 1 -- TODO
, list
, occurrences: 0
, parent: Nothing
, root: Nothing
, children: Set.empty
}
tne ngrams list = Tuple ngrams (ne ngrams list)
where
normed = normNgram ngramType ngrams
tne :: String -> TermList -> CTabNgramType -> Tuple NgramsTerm NgramsElement
tne ngrams list ngramType = Tuple normed (ne ngrams list ngramType)
where
normed = normNgram ngramType ngrams
nre :: String -> TermList -> CTabNgramType -> NgramsRepoElement
nre ngrams list ngramType = NgramsRepoElement { size: 1 -- TODO
, list
, parent: Nothing
, root: Nothing
, children: Set.empty
}
tnre :: String -> TermList -> CTabNgramType -> Tuple NgramsTerm NgramsRepoElement
tnre ngrams list ngramType = Tuple normed (nre ngrams list ngramType)
where
normed = normNgram ngramType ngrams
spec :: Spec Unit
spec = do
describe "NgramsTable.highlightNgrams" do
it "works on a simple example" do
let ngramType = CTabSources
let table = NgramsTable
(Map.fromFoldable [tne "graph" GraphTerm
,tne "which" StopTerm
,tne "stops" StopTerm
,tne "candidate" CandidateTerm
])
{ ngrams_repo_elements: Map.fromFoldable [ tnre "which" StopTerm ngramType
, tnre "stops" StopTerm ngramType
, tnre "candidate" CandidateTerm ngramType
]
, ngrams_scores: Map.fromFoldable [] }
input = "this is a graph about a biography which stops at every candidate"
output = [Tuple "this is a " Nothing
,Tuple "graph" (Just GraphTerm)
,Tuple " about a biography " Nothing
,Tuple "which" (Just StopTerm)
,Tuple " " Nothing
...
...
@@ -45,51 +66,53 @@ spec = do
highlightNgrams CTabTerms table input `shouldEqual` output
it "works when pattern overlaps" do
let ngramType = CTabSources
let table = NgramsTable
(Map.fromFoldable [tne "is" StopTerm
,tne "a" StopTerm
,tne "of" StopTerm
,tne "new" GraphTerm
,tne "the" GraphTerm
,tne "state" GraphTerm
])
{ ngrams_repo_elements: Map.fromFoldable [ tnre "is" StopTerm ngramType
, tnre "a" StopTerm ngramType
, tnre "of" StopTerm ngramType
]
, ngrams_scores: Map.fromFoldable [] }
input = "This is a new state of the"
output = [Tuple "This " Nothing
,Tuple "is" (Just StopTerm)
,Tuple " " Nothing
,Tuple "a" (Just StopTerm)
,Tuple " " Nothing
,Tuple "new"
(Just GraphTerm)
,Tuple "new"
Nothing
,Tuple " " Nothing
,Tuple "state"
(Just GraphTerm)
,Tuple "state"
Nothing
,Tuple " " Nothing
,Tuple "of" (Just StopTerm)
,Tuple " " Nothing
,Tuple "the"
(Just GraphTerm)
,Tuple "the"
Nothing
]
highlightNgrams CTabTerms table input `shouldEqual` output
it "works when pattern overlaps 2" do
let ngramType = CTabSources
let table = NgramsTable
(Map.fromFoldable [tne "from" GraphTerm
,tne "i" StopTerm
,tne "images" GraphTerm
])
{ ngrams_repo_elements: Map.fromFoldable [ tnre "from" CandidateTerm ngramType
, tnre "i" StopTerm ngramType
, tnre "images" CandidateTerm ngramType
]
, ngrams_scores: Map.fromFoldable [] }
input = "This is from space images"
output = [Tuple "This is " Nothing
,Tuple "from" (Just
Graph
Term)
,Tuple "from" (Just
Candidate
Term)
,Tuple " space " Nothing
,Tuple "images" (Just
Graph
Term)
,Tuple "images" (Just
Candidate
Term)
]
highlightNgrams CTabTerms table input `shouldEqual` output
it "works with punctuation" do
let ngramType = CTabSources
let table = NgramsTable
(Map.fromFoldable [tne "graph" GraphTerm])
{ ngrams_repo_elements: Map.fromFoldable [ tnre "graph" CandidateTerm ngramType ]
, ngrams_scores: Map.fromFoldable [] }
input = "before graph, after"
output = [Tuple "before " Nothing
,Tuple "graph" (Just
Graph
Term)
,Tuple "graph" (Just
Candidate
Term)
,Tuple ", after" Nothing
]
highlightNgrams CTabTerms table input `shouldEqual` output
-}
yarn.lock
View file @
f910cd90
This source diff could not be displayed because it is too large. You can
view the blob
instead.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment