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
63ec1b5c
Commit
63ec1b5c
authored
Mar 31, 2016
by
Romain Loth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
filter terms that became empty after normalization + esthetics
parent
a77ea0cf
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
7 deletions
+9
-7
ngram_coocs.py
gargantext/util/toolchain/ngram_coocs.py
+4
-3
ngrams_extraction.py
gargantext/util/toolchain/ngrams_extraction.py
+3
-2
terms.py
gargantext/views/pages/terms.py
+2
-2
No files found.
gargantext/util/toolchain/ngram_coocs.py
View file @
63ec1b5c
...
...
@@ -66,6 +66,7 @@ def compute_coocs(corpus,
"""
# - TODO add grouped element's values in grouping 'chief ngram'
# - TODO cvalue_id: allow a metric as additional input filter
# - TODO n_min, n_max : filter on Ngram.n (aka length of ngram)
# - TODO start, end : filter on document date
...
...
@@ -159,9 +160,9 @@ def compute_coocs(corpus,
matrix
=
WeightedMatrix
(
coocs_query
.
all
())
# fyi
#
shape_0 = len({pair[0] for pair in matrix.items})
#
shape_1 = len({pair[1] for pair in matrix.items})
#
print("COOCS: NEW matrix shape [%ix%i]" % (shape_0, shape_1))
shape_0
=
len
({
pair
[
0
]
for
pair
in
matrix
.
items
})
shape_1
=
len
({
pair
[
1
]
for
pair
in
matrix
.
items
})
print
(
"COOCS: NEW matrix shape [
%
ix
%
i]"
%
(
shape_0
,
shape_1
))
# 5) SAVE
# --------
...
...
gargantext/util/toolchain/ngrams_extraction.py
View file @
63ec1b5c
...
...
@@ -63,6 +63,7 @@ def extract_ngrams(corpus, keys=('title', 'abstract', )):
for
ngram
in
ngramsextractor
.
extract
(
value
):
tokens
=
tuple
(
token
[
0
]
for
token
in
ngram
)
terms
=
normalize_terms
(
' '
.
join
(
tokens
))
if
len
(
terms
)
>
1
:
nodes_ngrams_count
[(
document
.
id
,
terms
)]
+=
1
ngrams_data
.
add
((
terms
[:
255
],
len
(
tokens
),
))
# integrate ngrams and nodes-ngrams
...
...
gargantext/views/pages/terms.py
View file @
63ec1b5c
...
...
@@ -11,7 +11,7 @@ def ngramtable(request, project_id, corpus_id):
=> maplist and mainlist terms in a table
with groupings as '+' nodes
=> uses API GET batch of lists
=> uses API PUT/DEL for list modifications
(TODO)
=> uses API PUT/DEL for list modifications
=> uses frontend AJAX through Ngrams_dyna_charts_and_table.js
# TODO refactor Ngrams_dyna_charts_and_table.js
'''
...
...
@@ -21,7 +21,7 @@ def ngramtable(request, project_id, corpus_id):
# and the project just for project.id in corpusBannerTop
project
=
cache
.
Node
[
project_id
]
# rendered page :
journal
s.html
# rendered page :
term
s.html
return
render
(
template_name
=
'pages/corpora/terms.html'
,
request
=
request
,
...
...
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