Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
humanities
gargantext
Commits
92d5dfcd
Commit
92d5dfcd
authored
May 19, 2016
by
Romain Loth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pointers for listtype adjustments todo before release
parent
1f1e23ce
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
11 deletions
+17
-11
constants.py
gargantext/constants.py
+6
-4
lists.py
gargantext/util/lists.py
+11
-7
No files found.
gargantext/constants.py
View file @
92d5dfcd
...
...
@@ -8,18 +8,19 @@ import re
LISTTYPES
=
{
'DOCUMENT'
:
WeightedList
,
'GROUPLIST'
:
Translations
,
'GROUPLIST'
:
Translations
,
# todo remove "LIST" from name
'STOPLIST'
:
UnweightedList
,
'MAINLIST'
:
UnweightedList
,
'MAPLIST'
:
UnweightedList
,
'SPECIFICITY'
:
WeightedList
,
'OCCURRENCES'
:
Weighted
ContextIndex
,
'OCCURRENCES'
:
Weighted
Index
,
# todo replace by WeightedList
'COOCCURRENCES'
:
WeightedMatrix
,
'TFIDF-CORPUS'
:
Weighted
ContextIndex
,
'TFIDF-GLOBAL'
:
Weighted
ContextIndex
,
'TFIDF-CORPUS'
:
Weighted
Index
,
# todo split -> WeightedList for ti_rank and WeightedIndex for tfidf
'TFIDF-GLOBAL'
:
Weighted
Index
,
# todo split -> WeightedList for ti_rank and WeightedIndex for tfidf
}
NODETYPES
=
[
# TODO separate id not array index, read by models.node
None
,
# documents hierarchy
'USER'
,
# 1
...
...
@@ -40,6 +41,7 @@ NODETYPES = [
'TFIDF-GLOBAL'
,
# 14
# docs subset
'FAVORITES'
# 15
# TODO add ti RANK
]
INDEXED_HYPERDATA
=
{
...
...
gargantext/util/lists.py
View file @
92d5dfcd
...
...
@@ -2,7 +2,7 @@
"""
__all__
=
[
'Translations'
,
'WeightedMatrix'
,
'UnweightedList'
,
'WeightedList'
,
'Weighted
Context
Index'
]
__all__
=
[
'Translations'
,
'WeightedMatrix'
,
'UnweightedList'
,
'WeightedList'
,
'WeightedIndex'
]
from
gargantext.util.db
import
session
,
bulk_insert
...
...
@@ -165,15 +165,18 @@ class Translations(_BaseClass):
)
class
Weighted
Context
Index
(
_BaseClass
):
class
WeightedIndex
(
_BaseClass
):
"""
associated model : NodeNodeNgram
associated columns : node1_id | node2_id | ngram_id | score (float)
^^^^
reserved for this
object's id
Tensor representing a contextual index or registry
(matrix of weighted ngrams *per* doc *per* context
)
Matrix representing a weighted word index across docs or small context nodes
(matrix of weighted ngrams *per* doc
)
Exemple : tfidf
by
corpus
Exemple : tfidf
within a
corpus
"""
def
__init__
(
self
,
source
=
None
):
self
.
items
=
defaultdict
(
float
)
...
...
@@ -182,7 +185,7 @@ class WeightedContextIndex(_BaseClass):
# ?TODO rename WeightedWordmatrix
class
WeightedMatrix
(
_BaseClass
):
def
__init__
(
self
,
source
=
None
):
...
...
@@ -294,7 +297,7 @@ class WeightedMatrix(_BaseClass):
result
.
items
[
key1
,
key2
]
=
value
/
sqrt
(
other
.
items
[
key1
]
*
other
.
items
[
key2
])
return
result
# ?TODO rename Wordlist
class
UnweightedList
(
_BaseClass
):
def
__init__
(
self
,
source
=
None
):
...
...
@@ -399,6 +402,7 @@ class UnweightedList(_BaseClass):
)
# ?TODO rename WeightedWordlist
class
WeightedList
(
_BaseClass
):
def
__init__
(
self
,
source
=
None
):
...
...
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