Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
191
Issues
191
List
Board
Labels
Milestones
Merge Requests
8
Merge Requests
8
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
haskell-gargantext
Commits
66198af7
Commit
66198af7
authored
Jul 14, 2025
by
Alfredo Di Napoli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for complex ngrams forest hierarchy
parent
1964cc3c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
76 additions
and
0 deletions
+76
-0
Ngrams.hs
test/Test/Offline/Ngrams.hs
+76
-0
No files found.
test/Test/Offline/Ngrams.hs
View file @
66198af7
...
...
@@ -104,6 +104,7 @@ tests = describe "Ngrams" $ do
describe
"ngram forests"
$
do
it
"building a simple tree works"
testBuildNgramsTree_01
it
"building a complex tree works"
testBuildNgramsTree_02
it
"building a complex deep tree works"
testBuildNgramsTree_03
it
"pruning a simple tree works"
testPruningNgramsForest_01
it
"pruning a complex tree works"
testPruningNgramsForest_02
prop
"destroyForest . buildForest === id"
buildDestroyForestRoundtrips
...
...
@@ -194,6 +195,80 @@ testBuildNgramsTree_02 =
`- ford
|]
testBuildNgramsTree_03
::
Property
testBuildNgramsTree_03
=
let
input
=
Map
.
fromList
[
(
"animalia"
,
mkMapTerm
"animalia"
&
ne_children
.~
mSetFromList
[
"chordata"
])
,
(
"chordata"
,
mkMapTerm
"chordata"
&
ne_root
.~
Just
"animalia"
&
ne_parent
.~
Just
"animalia"
&
ne_children
.~
mSetFromList
[
"mammalia"
])
,
(
"mammalia"
,
mkMapTerm
"mammalia"
&
ne_root
.~
Just
"animalia"
&
ne_parent
.~
Just
"chordata"
&
ne_children
.~
mSetFromList
[
"carnivora"
,
"primates"
]
)
,
(
"carnivora"
,
mkMapTerm
"carnivora"
&
ne_root
.~
Just
"animalia"
&
ne_parent
.~
Just
"mammalia"
&
ne_children
.~
mSetFromList
[
"felidae"
]
)
,
(
"felidae"
,
mkMapTerm
"felidae"
&
ne_root
.~
Just
"animalia"
&
ne_parent
.~
Just
"carnivora"
&
ne_children
.~
mSetFromList
[
"panthera"
]
)
,
(
"panthera"
,
mkMapTerm
"panthera"
&
ne_root
.~
Just
"animalia"
&
ne_parent
.~
Just
"felidae"
&
ne_children
.~
mSetFromList
[
"panthera leo"
,
"panthera tigris"
]
)
,
(
"panthera leo"
,
mkMapTerm
"panthera leo"
&
ne_root
.~
Just
"animalia"
&
ne_parent
.~
Just
"pathera"
)
,
(
"panthera tigris"
,
mkMapTerm
"panthera tigris"
&
ne_root
.~
Just
"animalia"
&
ne_parent
.~
Just
"panthera"
)
,
(
"panthera tigris"
,
mkMapTerm
"panthera tigris"
&
ne_root
.~
Just
"animalia"
&
ne_parent
.~
Just
"panthera"
)
,
(
"primates"
,
mkMapTerm
"primates"
&
ne_root
.~
Just
"animalia"
&
ne_parent
.~
Just
"mammalia"
&
ne_children
.~
mSetFromList
[
"hominidae"
]
)
,
(
"hominidae"
,
mkMapTerm
"hominidae"
&
ne_root
.~
Just
"animalia"
&
ne_parent
.~
Just
"primates"
&
ne_children
.~
mSetFromList
[
"homo"
]
)
,
(
"homo"
,
mkMapTerm
"homo"
&
ne_root
.~
Just
"animalia"
&
ne_parent
.~
Just
"hominidae"
&
ne_children
.~
mSetFromList
[
"homo sapiens"
]
)
,
(
"homo sapies"
,
mkMapTerm
"homo sapiens"
&
ne_root
.~
Just
"animalia"
&
ne_parent
.~
Just
"homo"
)
]
in
pruneForest
(
buildForest
input
)
`
compareForestVisually
`
[
r
|
animalia
|
`- chordata
|
`- mammalia
|
+- carnivora
| |
| `- felidae
| |
| `- panthera
| |
| +- panthera leo
| |
| `- panthera tigris
|
`- primates
|
`- hominidae
|
`- homo
|]
newtype
TableMapLockStep
=
TableMapLockStep
{
getTableMap
::
Map
NgramsTerm
NgramsElement
}
deriving
(
Show
,
Eq
)
...
...
@@ -227,3 +302,4 @@ testPruningNgramsForest_02 =
|
`- ford
|]
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