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
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
Grégoire Locqueville
purescript-gargantext
Commits
03d92d24
Verified
Commit
03d92d24
authored
Jun 06, 2023
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ngrams] specialCharNormalize to properly highlight accents
But this will never be the same with what the backend is doing.
parent
57939c9a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
2 deletions
+14
-2
Functions.purs
src/Gargantext/Core/NgramsTable/Functions.purs
+4
-1
String.js
src/Gargantext/Utils/String.js
+5
-1
String.purs
src/Gargantext/Utils/String.purs
+5
-0
No files found.
src/Gargantext/Core/NgramsTable/Functions.purs
View file @
03d92d24
...
@@ -47,6 +47,7 @@ import Gargantext.Types (AsyncTask, AsyncTaskType(..), AsyncTaskWithType(..), CT
...
@@ -47,6 +47,7 @@ import Gargantext.Types (AsyncTask, AsyncTaskType(..), AsyncTaskWithType(..), CT
import Gargantext.Utils.Either (eitherMap)
import Gargantext.Utils.Either (eitherMap)
--import Gargantext.Utils.KarpRabin (indicesOfAny)
--import Gargantext.Utils.KarpRabin (indicesOfAny)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.String as GS
import Partial (crashWith)
import Partial (crashWith)
import Partial.Unsafe (unsafePartial)
import Partial.Unsafe (unsafePartial)
import Reactix as R
import Reactix as R
...
@@ -82,7 +83,9 @@ normNgramInternal :: CTabNgramType -> String -> String
...
@@ -82,7 +83,9 @@ normNgramInternal :: CTabNgramType -> String -> String
normNgramInternal CTabAuthors = identity
normNgramInternal CTabAuthors = identity
normNgramInternal CTabSources = identity
normNgramInternal CTabSources = identity
normNgramInternal CTabInstitutes = identity
normNgramInternal CTabInstitutes = identity
normNgramInternal CTabTerms = S.toLower <<< R.replace wordBoundaryReg " "
normNgramInternal CTabTerms = GS.specialCharNormalize
<<< S.toLower
<<< R.replace wordBoundaryReg " "
normNgramWithTrim :: CTabNgramType -> String -> String
normNgramWithTrim :: CTabNgramType -> String -> String
normNgramWithTrim nt = DSC.trim <<< normNgramInternal nt
normNgramWithTrim nt = DSC.trim <<< normNgramInternal nt
...
...
src/Gargantext/Utils/String.js
View file @
03d92d24
export
function
_btoa
(
s
)
{
export
function
_btoa
(
s
)
{
return
btoa
(
unescape
(
encodeURIComponent
(
s
)));
return
btoa
(
unescape
(
encodeURIComponent
(
s
)));
}
export
function
_specialCharNormalize
(
s
)
{
return
s
.
normalize
(
'NFD'
).
replace
(
/
[\u
0300-
\u
036f
]
/g
,
''
);
}
}
src/Gargantext/Utils/String.purs
View file @
03d92d24
...
@@ -7,9 +7,14 @@ import Data.Int as Int
...
@@ -7,9 +7,14 @@ import Data.Int as Int
import Data.Number.Format as DNF
import Data.Number.Format as DNF
foreign import _btoa :: Fn1 String String
foreign import _btoa :: Fn1 String String
foreign import _specialCharNormalize :: Fn1 String String
btoa :: String -> String
btoa :: String -> String
btoa = runFn1 _btoa
btoa = runFn1 _btoa
intToString :: Int -> String
intToString :: Int -> String
intToString = DNF.toString <<< Int.toNumber
intToString = DNF.toString <<< Int.toNumber
-- | https://ricardometring.com/javascript-replace-special-characters
specialCharNormalize :: String -> String
specialCharNormalize = runFn1 _specialCharNormalize
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