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
e887a14c
Commit
e887a14c
authored
Nov 24, 2017
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[DOCTEST] added.
parent
565e11e2
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
74 additions
and
18 deletions
+74
-18
gargantext.cabal
gargantext.cabal
+27
-11
package.yaml
package.yaml
+16
-2
Main.hs
src-doctest/Main.hs
+6
-0
Main.hs
src-test/Main.hs
+0
-0
Lang.hs
src-test/Ngrams/Lang.hs
+0
-0
En.hs
src-test/Ngrams/Lang/En.hs
+0
-0
Fr.hs
src-test/Ngrams/Lang/Fr.hs
+0
-0
Occurrences.hs
src-test/Ngrams/Lang/Occurrences.hs
+0
-0
Metrics.hs
src-test/Ngrams/Metrics.hs
+0
-0
WOS.hs
src-test/Parsers/WOS.hs
+0
-0
En.hs
src/Data/Gargantext/Ngrams/Lang/En.hs
+1
-0
Metrics.hs
src/Data/Gargantext/Ngrams/Metrics.hs
+21
-4
Main.hs
src/Data/Gargantext/Types/Main.hs
+0
-1
Node.hs
src/Data/Gargantext/Types/Node.hs
+1
-0
stack.yaml
stack.yaml
+2
-0
No files found.
gargantext.cabal
View file @
e887a14c
...
@@ -111,20 +111,28 @@ library
...
@@ -111,20 +111,28 @@ library
default-language: Haskell2010
default-language: Haskell2010
ghc-options: -Wall -Wincomplete-uni-patterns -Wincomplete-record-updates -Werror
ghc-options: -Wall -Wincomplete-uni-patterns -Wincomplete-record-updates -Werror
test-suite garg-
test-ngrams
test-suite garg-
doctest
type: exitcode-stdio-1.0
type: exitcode-stdio-1.0
ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N
main-is: Main.hs
default-language: Haskell2010
hs-source-dirs:
hs-source-dirs:
test
src-doctest
ghc-options: -Wall -Werror -threaded -rtsopts -with-rtsopts=-N
build-depends:
extra
, text
, doctest
, Glob
, QuickCheck
, base
, gargantext
default-language: Haskell2010
test-suite garg-test
type: exitcode-stdio-1.0
main-is: Main.hs
main-is: Main.hs
other-modules:
hs-source-dirs:
Ngrams.Lang
src-test
Ngrams.Lang.En
ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N
Ngrams.Lang.Fr
Ngrams.Lang.Occurrences
Ngrams.Metrics
Parsers.WOS
build-depends:
build-depends:
extra
extra
, text
, text
...
@@ -132,3 +140,11 @@ test-suite garg-test-ngrams
...
@@ -132,3 +140,11 @@ test-suite garg-test-ngrams
, gargantext
, gargantext
, hspec
, hspec
, QuickCheck
, QuickCheck
other-modules:
Ngrams.Lang
Ngrams.Lang.En
Ngrams.Lang.Fr
Ngrams.Lang.Occurrences
Ngrams.Metrics
Parsers.WOS
default-language: Haskell2010
package.yaml
View file @
e887a14c
...
@@ -104,9 +104,9 @@ library:
...
@@ -104,9 +104,9 @@ library:
-
zip
-
zip
-
path-io
-
path-io
tests
:
tests
:
garg-test
-ngrams
:
garg-test
:
main
:
Main.hs
main
:
Main.hs
source-dirs
:
test
source-dirs
:
src-
test
ghc-options
:
ghc-options
:
-
-threaded
-
-threaded
-
-rtsopts
-
-rtsopts
...
@@ -116,3 +116,17 @@ tests:
...
@@ -116,3 +116,17 @@ tests:
-
gargantext
-
gargantext
-
hspec
-
hspec
-
QuickCheck
-
QuickCheck
garg-doctest
:
main
:
Main.hs
source-dirs
:
src-doctest
ghc-options
:
-
-Werror
-
-threaded
-
-rtsopts
-
-with-rtsopts=-N
dependencies
:
-
doctest
-
Glob
-
QuickCheck
-
base
-
gargantext
src-doctest/Main.hs
0 → 100644
View file @
e887a14c
import
System.FilePath.Glob
import
Test.DocTest
main
::
IO
()
main
=
glob
"src/**/*.hs"
>>=
doctest
test/Main.hs
→
src-
test/Main.hs
View file @
e887a14c
File moved
test/Ngrams/Lang.hs
→
src-
test/Ngrams/Lang.hs
View file @
e887a14c
File moved
test/Ngrams/Lang/En.hs
→
src-
test/Ngrams/Lang/En.hs
View file @
e887a14c
File moved
test/Ngrams/Lang/Fr.hs
→
src-
test/Ngrams/Lang/Fr.hs
View file @
e887a14c
File moved
test/Ngrams/Lang/Occurrences.hs
→
src-
test/Ngrams/Lang/Occurrences.hs
View file @
e887a14c
File moved
test/Ngrams/Metrics.hs
→
src-
test/Ngrams/Metrics.hs
View file @
e887a14c
File moved
test/Parsers/WOS.hs
→
src-
test/Parsers/WOS.hs
View file @
e887a14c
File moved
src/Data/Gargantext/Ngrams/Lang/En.hs
View file @
e887a14c
...
@@ -66,6 +66,7 @@ groupNgrams ((x,"NN",_):(o,"IN",_):(det,"DT",_):(y,"NNP",yy):xs) = groupNg
...
@@ -66,6 +66,7 @@ groupNgrams ((x,"NN",_):(o,"IN",_):(det,"DT",_):(y,"NNP",yy):xs) = groupNg
groupNgrams
((
x
,
_
,
"PERSON"
)
:
(
y
,
yy
,
"PERSON"
)
:
xs
)
=
groupNgrams
((
x
<>
" "
<>
y
,
yy
,
"PERSON"
)
:
xs
)
groupNgrams
((
x
,
_
,
"PERSON"
)
:
(
y
,
yy
,
"PERSON"
)
:
xs
)
=
groupNgrams
((
x
<>
" "
<>
y
,
yy
,
"PERSON"
)
:
xs
)
groupNgrams
((
x
,
_
,
"ORGANIZATION"
)
:
(
y
,
yy
,
"ORGANIZATION"
)
:
xs
)
=
groupNgrams
((
x
<>
" "
<>
y
,
yy
,
"ORGANIZATION"
)
:
xs
)
groupNgrams
((
x
,
_
,
"ORGANIZATION"
)
:
(
y
,
yy
,
"ORGANIZATION"
)
:
xs
)
=
groupNgrams
((
x
<>
" "
<>
y
,
yy
,
"ORGANIZATION"
)
:
xs
)
groupNgrams
((
x
,
_
,
"LOCATION"
)
:
(
y
,
yy
,
"LOCATION"
)
:
xs
)
=
groupNgrams
((
x
<>
" "
<>
y
,
yy
,
"LOCATION"
)
:
xs
)
groupNgrams
(
x
:
xs
)
=
(
x
:
(
groupNgrams
xs
))
groupNgrams
(
x
:
xs
)
=
(
x
:
(
groupNgrams
xs
))
...
...
src/Data/Gargantext/Ngrams/Metrics.hs
View file @
e887a14c
{-|
Module : Data.Gargantext.Ngrams.Metrics
Description : Short description
Copyright : (c) Some Guy, 2013
Someone Else, 2014
License : GPL-3
Maintainer : sample@email.com
Stability : experimental
Portability : POSIX
Here is a longer description of this module, containing some
commentary with @some markup@.
-}
module
Data.Gargantext.Ngrams.Metrics
(
levenshtein
module
Data.Gargantext.Ngrams.Metrics
(
levenshtein
,
levenshteinNorm
,
levenshteinNorm
,
damerauLevenshtein
,
damerauLevenshtein
...
@@ -11,6 +25,9 @@ import Data.Text (Text)
...
@@ -11,6 +25,9 @@ import Data.Text (Text)
import
GHC.Real
(
Ratio
)
import
GHC.Real
(
Ratio
)
import
qualified
Data.Text.Metrics
as
DTM
import
qualified
Data.Text.Metrics
as
DTM
{- * Example de titre
-}
-- | This module provide metrics to compare Text
-- | This module provide metrics to compare Text
-- starting as an API rexporting main functions of the great lib
-- starting as an API rexporting main functions of the great lib
-- text-metrics of Mark Karpov
-- text-metrics of Mark Karpov
...
@@ -20,7 +37,7 @@ import qualified Data.Text.Metrics as DTM
...
@@ -20,7 +37,7 @@ import qualified Data.Text.Metrics as DTM
-- the Levenshtein distance is a string metric for measuring
-- the Levenshtein distance is a string metric for measuring
-- the difference between two sequences.
-- the difference between two sequences.
-- See: https://en.wikipedia.org/wiki/Levenshtein_distance
-- See: https://en.wikipedia.org/wiki/Levenshtein_distance
--
levenshtein
::
Text
->
Text
->
Int
levenshtein
::
Text
->
Text
->
Int
levenshtein
=
DTM
.
levenshtein
levenshtein
=
DTM
.
levenshtein
...
@@ -28,7 +45,7 @@ levenshtein = DTM.levenshtein
...
@@ -28,7 +45,7 @@ levenshtein = DTM.levenshtein
-- Result is a non-negative rational number (represented as @'Ratio'
-- Result is a non-negative rational number (represented as @'Ratio'
-- 'Data.Numeric.Natural'@), where 0 signifies no similarity between the
-- 'Data.Numeric.Natural'@), where 0 signifies no similarity between the
-- strings, while 1 means exact match.
-- strings, while 1 means exact match.
--
levenshteinNorm
::
Text
->
Text
->
Ratio
Int
levenshteinNorm
::
Text
->
Text
->
Ratio
Int
levenshteinNorm
=
DTM
.
levenshteinNorm
levenshteinNorm
=
DTM
.
levenshteinNorm
...
@@ -37,12 +54,12 @@ levenshteinNorm = DTM.levenshteinNorm
...
@@ -37,12 +54,12 @@ levenshteinNorm = DTM.levenshteinNorm
-- operations also includes transposition of two /adjacent/ characters.
-- operations also includes transposition of two /adjacent/ characters.
-- See also:
-- See also:
-- <https://en.wikipedia.org/wiki/Damerau%E2%80%93Levenshtein_distance>
-- <https://en.wikipedia.org/wiki/Damerau%E2%80%93Levenshtein_distance>
--
damerauLevenshtein
::
Text
->
Text
->
Int
damerauLevenshtein
::
Text
->
Text
->
Int
damerauLevenshtein
=
DTM
.
damerauLevenshtein
damerauLevenshtein
=
DTM
.
damerauLevenshtein
-- damerau-Levenshtein distance normalized
-- damerau-Levenshtein distance normalized
--
damerauLevenshteinNorm
::
Text
->
Text
->
Ratio
Int
damerauLevenshteinNorm
::
Text
->
Text
->
Ratio
Int
damerauLevenshteinNorm
=
DTM
.
damerauLevenshteinNorm
damerauLevenshteinNorm
=
DTM
.
damerauLevenshteinNorm
...
...
src/Data/Gargantext/Types/Main.hs
View file @
e887a14c
...
@@ -26,7 +26,6 @@ data Language = EN | FR -- | DE | IT | SP
...
@@ -26,7 +26,6 @@ data Language = EN | FR -- | DE | IT | SP
-- > SP == spanish (not implemented yet)
-- > SP == spanish (not implemented yet)
-- > ... add your language and help us to implement it (:
-- > ... add your language and help us to implement it (:
type
Ngrams
=
(
Text
,
Text
,
Text
)
type
Ngrams
=
(
Text
,
Text
,
Text
)
-- | TODO add Symbolic Node / Document
-- | TODO add Symbolic Node / Document
...
...
src/Data/Gargantext/Types/Node.hs
View file @
e887a14c
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveGeneric #-}
-- {-# LANGUAGE DuplicateRecordFields #-}
module
Data.Gargantext.Types.Node
where
module
Data.Gargantext.Types.Node
where
...
...
stack.yaml
View file @
e887a14c
...
@@ -7,4 +7,6 @@ extra-deps:
...
@@ -7,4 +7,6 @@ extra-deps:
-
aeson-1.0.2.1
-
aeson-1.0.2.1
-
duckling-0.1.3.0
-
duckling-0.1.3.0
-
protolude-0.2
-
protolude-0.2
-
generic-lens-0.4.0.1
-
GenericPretty-1.2.1
resolver
:
lts-9.2
resolver
:
lts-9.2
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