Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Przemyslaw Kaminski
haskell-gargantext
Commits
8b95cfb2
Commit
8b95cfb2
authored
Nov 19, 2018
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[DB][FLOW] bug fixed, flow seems ok.
parent
5a2df841
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
25 deletions
+7
-25
Flow.hs
src/Gargantext/Database/Flow.hs
+1
-1
Ngrams.hs
src/Gargantext/Database/Ngrams.hs
+6
-24
No files found.
src/Gargantext/Database/Flow.hs
View file @
8b95cfb2
...
...
@@ -80,7 +80,6 @@ flowDatabase ff fp cName = do
let
docsWithNgrams
=
documentIdWithNgrams
extractNgramsT
documentsWithId
printDebug
"docsWithNgrams"
docsWithNgrams
{-
let
maps
=
mapNodeIdNgrams
docsWithNgrams
printDebug
"maps"
(
maps
)
...
...
@@ -95,6 +94,7 @@ flowDatabase ff fp cName = do
printDebug
"Docs IDs : "
(
length
idsRepeat
)
{-
-}
(
_
,
_
,
corpusId2
)
<-
subFlow
"user1"
cName
{-
...
...
src/Gargantext/Database/Ngrams.hs
View file @
8b95cfb2
...
...
@@ -77,7 +77,7 @@ import qualified Database.PostgreSQL.Simple as DPS
-- ngrams in authors field of document has Authors Type
-- ngrams in text (title or abstract) of documents has Terms Type
data
NgramsType
=
Authors
|
Institutes
|
Sources
|
Terms
deriving
(
Eq
,
Show
)
deriving
(
Eq
,
Show
,
Ord
)
ngramsTypeId
::
NgramsType
->
Int
ngramsTypeId
Authors
=
1
...
...
@@ -93,11 +93,8 @@ type Size = Int
-- | TODO put it in Gargantext.Text.Ngrams
data
Ngrams
=
Ngrams
{
_ngramsTerms
::
Text
,
_ngramsSize
::
Int
}
deriving
(
Generic
,
Show
)
instance
Eq
Ngrams
where
(
==
)
=
(
==
)
instance
Ord
Ngrams
where
compare
=
compare
}
deriving
(
Generic
,
Show
,
Eq
,
Ord
)
makeLenses
''
N
grams
instance
DPS
.
ToRow
Ngrams
where
toRow
(
Ngrams
t
s
)
=
[
toField
t
,
toField
s
]
...
...
@@ -111,37 +108,23 @@ text2ngrams txt = Ngrams txt $ length $ splitOn " " txt
data
NgramsT
a
=
NgramsT
{
_ngramsType
::
NgramsType
,
_ngramsT
::
a
}
deriving
(
Generic
,
Show
)
instance
Eq
(
NgramsT
a
)
where
(
==
)
=
(
==
)
-- where NgramsT
-- t1 == t2
-- n1 == n2
}
deriving
(
Generic
,
Show
,
Eq
,
Ord
)
instance
Ord
(
NgramsT
a
)
where
compare
=
compare
makeLenses
''
N
gramsT
-----------------------------------------------------------------------
data
NgramsIndexed
=
NgramsIndexed
{
_ngrams
::
Ngrams
,
_ngramsId
::
NgramsId
}
deriving
(
Show
,
Generic
)
}
deriving
(
Show
,
Generic
,
Eq
,
Ord
)
instance
Eq
NgramsIndexed
where
(
==
)
=
(
==
)
instance
Ord
NgramsIndexed
where
compare
=
compare
makeLenses
''
N
gramsIndexed
------------------------------------------------------------------------
data
NgramIds
=
NgramIds
{
ngramId
::
Int
,
ngramTerms
::
Text
}
deriving
(
Show
,
Generic
)
}
deriving
(
Show
,
Generic
,
Eq
,
Ord
)
instance
DPS
.
FromRow
NgramIds
where
fromRow
=
NgramIds
<$>
field
<*>
field
...
...
@@ -163,7 +146,6 @@ insertNgrams' ns = mkCmd $ \conn -> DPS.query conn queryInsertNgrams (DPS.Only $
where
fields
=
map
(
\
t
->
QualifiedIdentifier
Nothing
t
)
[
"text"
,
"int4"
]
insertNgrams_Debug
::
[(
NgramsTerms
,
Size
)]
->
Cmd
ByteString
insertNgrams_Debug
ns
=
mkCmd
$
\
conn
->
DPS
.
formatQuery
conn
queryInsertNgrams
(
DPS
.
Only
$
Values
fields
ns
)
where
...
...
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