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
3c6a72c6
Commit
3c6a72c6
authored
Feb 23, 2015
by
Administrator
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'unstable' into testing
parents
ce794fa6
4fbc8a98
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
63 additions
and
7 deletions
+63
-7
functions.py
analysis/functions.py
+3
-1
settings.py
gargantext_web/settings.py
+1
-0
urls.py
gargantext_web/urls.py
+1
-0
views.py
gargantext_web/views.py
+28
-4
models.py
node/models.py
+3
-2
maintenance.html
templates/maintenance.html
+27
-0
No files found.
analysis/functions.py
View file @
3c6a72c6
...
...
@@ -280,13 +280,15 @@ def do_tfidf(corpus, reset=True):
# print("the doc:",document)
somevariable
=
Node_Ngram
.
objects
.
filter
(
node
=
document
)
for
node_ngram
in
somevariable
:
# print("\tngram:",node_ngram.ngram)
try
:
# print("\tngram:",node_ngram.ngram, " @@@ type:",type(node_ngram.ngram))
nnn
=
NodeNodeNgram
.
objects
.
get
(
nodex
=
corpus
,
nodey
=
document
,
ngram
=
node_ngram
.
ngram
)
# print("\t\tTRY")
except
:
score
=
tfidf
(
corpus
,
document
,
node_ngram
.
ngram
)
nnn
=
NodeNodeNgram
(
nodex
=
corpus
,
nodey
=
node_ngram
.
node
,
ngram
=
node_ngram
.
ngram
,
score
=
score
)
nnn
.
save
()
# print("\t\tEXC: ",score)
# print("- - - - - - - - - - \n")
else
:
print
(
"Only corpus implemented yet, you put instead:"
,
type
(
corpus
))
...
...
gargantext_web/settings.py
View file @
3c6a72c6
...
...
@@ -28,6 +28,7 @@ SECRET_KEY = 'bt)3n9v&a02cu7^^=+u_t2tmn8ex5fvx8$x4r*j*pb1yawd+rz'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG
=
True
MAINTENANCE
=
False
TEMPLATE_DEBUG
=
True
...
...
gargantext_web/urls.py
View file @
3c6a72c6
...
...
@@ -26,6 +26,7 @@ urlpatterns = patterns('',
# User Home view
url
(
r'^$'
,
views
.
home
),
url
(
r'^about/'
,
views
.
get_about
),
url
(
r'^maintenance/'
,
views
.
get_maintenance
),
# Project Management
url
(
r'^projects/$'
,
views
.
projects
),
...
...
gargantext_web/views.py
View file @
3c6a72c6
...
...
@@ -28,7 +28,7 @@ from parsing.FileParsers import *
# SOME FUNCTIONS
from
gargantext_web.settings
import
DEBUG
,
STATIC_ROOT
from
gargantext_web.settings
import
DEBUG
,
STATIC_ROOT
,
MAINTENANCE
from
django.http
import
*
from
django.shortcuts
import
render_to_response
,
redirect
from
django.template
import
RequestContext
...
...
@@ -50,7 +50,9 @@ def login_user(request):
if
user
.
is_active
:
login
(
request
,
user
)
return
HttpResponseRedirect
(
'/projects/'
)
print
(
"MAINTENANCE:"
,
MAINTENANCE
)
if
MAINTENANCE
:
return
HttpResponseRedirect
(
'/maintenance/'
)
else
:
return
HttpResponseRedirect
(
'/projects/'
)
return
render_to_response
(
'authentication.html'
,
context_instance
=
RequestContext
(
request
))
...
...
@@ -166,6 +168,21 @@ def get_about(request):
return
HttpResponse
(
html
)
def
get_maintenance
(
request
):
'''
Gargantext out of service
'''
template
=
get_template
(
'maintenance.html'
)
user
=
request
.
user
date
=
datetime
.
datetime
.
now
()
html
=
template
.
render
(
Context
({
\
'user'
:
user
,
\
'date'
:
date
,
\
}))
return
HttpResponse
(
html
)
def
home
(
request
):
'''
...
...
@@ -192,6 +209,7 @@ def projects(request):
'''
if
not
request
.
user
.
is_authenticated
():
return
redirect
(
'/auth/'
)
if
MAINTENANCE
:
return
HttpResponseRedirect
(
'/maintenance/'
)
t
=
get_template
(
'projects.html'
)
...
...
@@ -237,7 +255,7 @@ def project(request, project_id):
offset
=
str
(
project_id
)
except
ValueError
:
raise
Http404
()
if
MAINTENANCE
:
return
HttpResponseRedirect
(
'/maintenance/'
)
user
=
request
.
user
date
=
datetime
.
datetime
.
now
()
...
...
@@ -415,6 +433,7 @@ def corpus(request, project_id, corpus_id):
offset
=
str
(
corpus_id
)
except
ValueError
:
raise
Http404
()
if
MAINTENANCE
:
return
HttpResponseRedirect
(
'/maintenance/'
)
t
=
get_template
(
'corpus.html'
)
...
...
@@ -660,6 +679,7 @@ def delete_corpus(request, project_id, corpus_id):
def
chart
(
request
,
project_id
,
corpus_id
):
''' Charts to compare, filter, count'''
if
MAINTENANCE
:
return
HttpResponseRedirect
(
'/maintenance/'
)
t
=
get_template
(
'chart.html'
)
user
=
request
.
user
date
=
datetime
.
datetime
.
now
()
...
...
@@ -676,6 +696,7 @@ def chart(request, project_id, corpus_id):
return
HttpResponse
(
html
)
def
matrix
(
request
,
project_id
,
corpus_id
):
if
MAINTENANCE
:
return
HttpResponseRedirect
(
'/maintenance/'
)
t
=
get_template
(
'matrix.html'
)
user
=
request
.
user
date
=
datetime
.
datetime
.
now
()
...
...
@@ -693,6 +714,7 @@ def matrix(request, project_id, corpus_id):
return
HttpResponse
(
html
)
def
graph
(
request
,
project_id
,
corpus_id
):
if
MAINTENANCE
:
return
HttpResponseRedirect
(
'/maintenance/'
)
t
=
get_template
(
'explorer.html'
)
user
=
request
.
user
date
=
datetime
.
datetime
.
now
()
...
...
@@ -714,6 +736,7 @@ def graph(request, project_id, corpus_id):
def
exploration
(
request
):
if
MAINTENANCE
:
return
HttpResponseRedirect
(
'/maintenance/'
)
t
=
get_template
(
'exploration.html'
)
user
=
request
.
user
date
=
datetime
.
datetime
.
now
()
...
...
@@ -726,6 +749,7 @@ def exploration(request):
return
HttpResponse
(
html
)
def
explorer_chart
(
request
):
if
MAINTENANCE
:
return
HttpResponseRedirect
(
'/maintenance/'
)
t
=
get_template
(
'chart.html'
)
user
=
request
.
user
date
=
datetime
.
datetime
.
now
()
...
...
node/models.py
View file @
3c6a72c6
...
...
@@ -230,8 +230,9 @@ class Node(CTENode):
terms
=
' '
.
join
([
token
for
token
,
tag
in
ngram
])
associations
[
terms
]
+=
1
# import pprint
# pprint.pprint(associations)
import
pprint
pprint
.
pprint
(
associations
)
print
(
" - - - - - "
)
#print(associations)
# insert the occurrences in the database
# print(associations.items())
...
...
templates/maintenance.html
0 → 100644
View file @
3c6a72c6
{% extends "menu.html" %}
{% block css %}
{% load staticfiles %}
<link
rel=
"stylesheet"
href=
"{% static "
css
/
bootstrap
.
css
"
%}"
>
<script
src=
"{% static "
js
/
jquery
/
jquery
.
min
.
js
"
%}"
type=
"text/javascript"
></script>
{% endblock %}
{% block content %}
<div
class=
"container theme-showcase"
role=
"main"
>
<div
class=
"jumbotron"
>
<h1>
Gargantext in reparations...
</h1>
</div>
</div>
{% endblock %}
\ No newline at end of file
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