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
be968d2c
Commit
be968d2c
authored
Jun 04, 2015
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] fix conflicts.
parent
04b49e8a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
39 deletions
+54
-39
utils.py
admin/utils.py
+1
-0
functions.py
analysis/functions.py
+37
-35
init_gargantext.py
init/init_gargantext.py
+16
-3
test_db.py
init/test_db.py
+0
-1
No files found.
admin/utils.py
View file @
be968d2c
...
@@ -28,3 +28,4 @@ def PrintException():
...
@@ -28,3 +28,4 @@ def PrintException():
line
=
linecache
.
getline
(
filename
,
lineno
,
f
.
f_globals
)
line
=
linecache
.
getline
(
filename
,
lineno
,
f
.
f_globals
)
print
(
'EXCEPTION IN ({}, LINE {} "{}"): {}'
.
format
(
filename
,
lineno
,
line
.
strip
(),
exc_obj
))
print
(
'EXCEPTION IN ({}, LINE {} "{}"): {}'
.
format
(
filename
,
lineno
,
line
.
strip
(),
exc_obj
))
analysis/functions.py
View file @
be968d2c
...
@@ -236,21 +236,23 @@ def get_cooc(request=None, corpus_id=None, cooc_id=None, type='node_link', size=
...
@@ -236,21 +236,23 @@ def get_cooc(request=None, corpus_id=None, cooc_id=None, type='node_link', size=
# Removing unconnected nodes
# Removing unconnected nodes
xxx
=
xx
.
values
xxx
=
xx
.
values
threshold
=
min
(
xxx
.
max
(
axis
=
1
))
threshold
=
min
(
xxx
.
max
(
axis
=
1
))
matrix_filtered
=
np
.
where
(
xxx
>
threshold
,
xxx
,
0
)
matrix_filtered
=
np
.
where
(
xxx
>
=
threshold
,
xxx
,
0
)
#matrix_filtered = matrix_filtered.resize((90,90))
#matrix_filtered = matrix_filtered.resize((90,90))
except
:
except
:
PrintException
()
PrintException
()
try
:
try
:
G
=
nx
.
from_numpy_matrix
(
matrix_filtered
)
G
=
nx
.
from_numpy_matrix
(
matrix_filtered
,
create_using
=
nx
.
MultiDiGraph
()
)
G
=
nx
.
relabel_nodes
(
G
,
dict
(
enumerate
([
labels
[
label
]
for
label
in
list
(
xx
.
columns
)])))
G
=
nx
.
relabel_nodes
(
G
,
dict
(
enumerate
([
labels
[
label
]
for
label
in
list
(
xx
.
columns
)])))
#print(G)
#print(G)
# Removing too connected nodes (find automatic way to do it)
# Removing too connected nodes (find automatic way to do it)
#edges_to_remove = [ e for e in G.edges_iter() if
degree
=
G
.
degree
()
degree
=
G
.
degree
()
to_remove
=
[
n
for
n
in
degree
if
degree
[
n
]
<=
1
]
nodes_
to_remove
=
[
n
for
n
in
degree
if
degree
[
n
]
<=
1
]
G
.
remove_nodes_from
(
to_remove
)
G
.
remove_nodes_from
(
nodes_
to_remove
)
partition
=
best_partition
(
G
)
partition
=
best_partition
(
G
)
except
:
except
:
...
...
init/init_gargantext.py
View file @
be968d2c
...
@@ -82,9 +82,8 @@ print('Initialize node types...')
...
@@ -82,9 +82,8 @@ print('Initialize node types...')
node_types
=
[
node_types
=
[
'Root'
,
'Trash'
,
'Root'
,
'Trash'
,
'Project'
,
'Corpus'
,
'Document'
,
'Project'
,
'Corpus'
,
'Document'
,
'Stem'
,
'Lem'
,
'Tfidf'
,
'MiamList'
,
'StopList'
,
'MainList'
,
'Synonym'
,
'Stem'
,
'Lem'
,
'Group'
,
'Tfidf'
,
'MiamList'
,
'StopList'
,
'Cooccurrence'
,
'WhiteList'
,
'BlackList'
'Cooccurrence'
,
'WhiteList'
,
'BlackList'
]
]
...
@@ -93,6 +92,20 @@ for node_type in node_types:
...
@@ -93,6 +92,20 @@ for node_type in node_types:
# Integration: resource types
# Integration: resource types
print
(
'Initialize users...'
)
me
=
session
.
query
(
User
)
.
filter
(
User
.
username
==
'alexandre'
)
.
first
()
gargantua
=
session
.
query
(
User
)
.
filter
(
User
.
username
==
'gargantua'
)
.
first
()
node_root
=
Node
(
user_id
=
gargantua
.
id
,
type_id
=
cache
.
NodeType
[
'Root'
]
.
id
,
name
=
'Root'
)
node_stem
=
Node
(
user_id
=
gargantua
.
id
,
type_id
=
cache
.
NodeType
[
'Stem'
]
.
id
,
name
=
'Stem'
,
parent_id
=
node_root
.
id
)
node_lem
=
Node
(
user_id
=
gargantua
.
id
,
type_id
=
cache
.
NodeType
[
'Lem'
]
.
id
,
name
=
'Lem'
,
parent_id
=
node_root
.
id
)
session
.
add
(
node_root
)
session
.
add
(
node_stem
)
session
.
add
(
node_lem
)
session
.
commit
()
print
(
'Initialize resource...'
)
print
(
'Initialize resource...'
)
from
parsing.parsers_config
import
parsers
from
parsing.parsers_config
import
parsers
...
...
init/test_db.py
View file @
be968d2c
...
@@ -35,7 +35,6 @@ extract_ngrams(corpus, ('title', ))
...
@@ -35,7 +35,6 @@ extract_ngrams(corpus, ('title', ))
# print(corpus)
# corpus = session.query(Node).filter(Node.id == 72771).first()
# corpus = session.query(Node).filter(Node.id == 72771).first()
# corpus = session.query(Node).filter(Node.id == 73017).first()
# corpus = session.query(Node).filter(Node.id == 73017).first()
compute_tfidf
(
corpus
)
compute_tfidf
(
corpus
)
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