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
1d1a297a
Commit
1d1a297a
authored
Jan 13, 2015
by
PkSM3
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'unstable' of
ssh://delanoe.org:1979/gargantext
into samuel
parents
d790f62d
21fec896
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
66 additions
and
67 deletions
+66
-67
functions.py
analysis/functions.py
+4
-1
views.py
gargantext_web/views.py
+36
-36
README.rst
init/README.rst
+15
-1
README_old.txt
init/README_old.txt
+0
-22
EuropressFileParser.py
parsing/FileParsers/EuropressFileParser.py
+6
-5
home.html
templates/home.html
+4
-0
subcorpus.html
templates/subcorpus.html
+1
-2
No files found.
analysis/functions.py
View file @
1d1a297a
...
@@ -54,6 +54,9 @@ def create_whitelist(user, corpus, size=100):
...
@@ -54,6 +54,9 @@ def create_whitelist(user, corpus, size=100):
n.type_id =
%
d
n.type_id =
%
d
AND
AND
ngX.n >= 2
ngX.n >= 2
AND
ngX.n <= 3
GROUP BY
GROUP BY
ngX.id
ngX.id
...
@@ -254,7 +257,7 @@ def tfidf(corpus, document, ngram):
...
@@ -254,7 +257,7 @@ def tfidf(corpus, document, ngram):
# result = tf * idf
# result = tf * idf
result
=
term_frequency
*
inverse_d_frequency
result
=
term_frequency
*
inverse_d_frequency
except
Exception
as
error
:
except
Exception
as
error
:
print
(
error
)
print
(
error
,
ngram
)
result
=
0
result
=
0
return
result
return
result
...
...
gargantext_web/views.py
View file @
1d1a297a
...
@@ -341,41 +341,41 @@ def corpus(request, project_id, corpus_id):
...
@@ -341,41 +341,41 @@ def corpus(request, project_id, corpus_id):
# except:
# except:
# sources_donut = []
# sources_donut = []
# Do a javascript query/api for that
# Do a javascript query/api for that
query_date
=
"""
#
query_date = """
SELECT
#
SELECT
id,
#
id,
metadata -> 'publication_year' as year,
#
metadata -> 'publication_year' as year,
metadata -> 'publication_month' as month,
#
metadata -> 'publication_month' as month,
metadata -> 'publication_day' as day,
#
metadata -> 'publication_day' as day,
metadata -> 'title'
#
metadata -> 'title'
FROM
#
FROM
node_node AS n
#
node_node AS n
WHERE
#
WHERE
n.parent_id =
%
d
#
n.parent_id = %d
ORDER BY
#
ORDER BY
year, month, day DESC
#
year, month, day DESC
LIMIT
#
LIMIT
20
#
20
OFFSET
#
OFFSET
%
d
#
%d
"""
%
(
corpus
.
id
,
0
)
#
""" % (corpus.id, 0)
try
:
#
try:
cursor
=
connection
.
cursor
()
#
cursor = connection.cursor()
#
cursor
.
execute
(
query_date
)
#
cursor.execute(query_date)
documents
=
list
()
#
documents = list()
while
True
:
#
while True:
document
=
dict
()
#
document = dict()
row
=
cursor
.
fetchone
()
#
row = cursor.fetchone()
#
if
row
is
None
:
#
if row is None:
break
#
break
document
[
'id'
]
=
row
[
0
]
#
document['id'] = row[0]
document
[
'date'
]
=
row
[
1
]
+
'/'
+
row
[
2
]
+
'/'
+
row
[
3
]
#
document['date'] = row[1] + '/' + row[2] + '/' + row[3]
document
[
'title'
]
=
row
[
4
]
#
document['title'] = row[4]
documents
.
append
(
document
)
#
documents.append(document)
except
Exception
as
error
:
#
except Exception as error:
print
(
error
)
#
print(error)
try
:
try
:
chart
=
dict
()
chart
=
dict
()
...
@@ -390,7 +390,7 @@ def corpus(request, project_id, corpus_id):
...
@@ -390,7 +390,7 @@ def corpus(request, project_id, corpus_id):
'date'
:
date
,
\
'date'
:
date
,
\
'project'
:
project
,
\
'project'
:
project
,
\
'corpus'
:
corpus
,
\
'corpus'
:
corpus
,
\
'documents'
:
documents
,
\
#
'documents': documents,\
'number'
:
number
,
\
'number'
:
number
,
\
'dates'
:
chart
,
\
'dates'
:
chart
,
\
}))
}))
...
...
init/README.rst
View file @
1d1a297a
...
@@ -139,4 +139,18 @@ Start the Django server
...
@@ -139,4 +139,18 @@ Start the Django server
-----------------------
-----------------------
in bash to launch python env : /srv/gargantext_env/bin/activate
in bash to launch python env : /srv/gargantext_env/bin/activate
In Pyvenv:
In Pyvenv:
python manage.py runserver
$ python manage.py runserver
For Production Server
---------------------
git checkout stable
$ sudo aptitude install rabbitmq-server
$ sudo aptitude install tmux
# In your python envrionment:
$ tmux -c ./manage.py celery worker --loglevel=info
$ python manage.py runserver
init/README_old.txt
deleted
100644 → 0
View file @
d790f62d
Here informations for installation:
-----------------------------------
I - Local Installation
All informations are in init folder
1) Create virtualenv with python version 3.4
2) pip install -r requirements.txt
3) Manually install nltk (inside the sources)
nltk==3.0a4
4) adapt database configuration in gargantext_web settings
(Development done on postgresql)
5) source env/bin/activate
6) ./manage.py runserver
That's all
parsing/FileParsers/EuropressFileParser.py
View file @
1d1a297a
...
@@ -28,11 +28,12 @@ class EuropressFileParser(FileParser):
...
@@ -28,11 +28,12 @@ class EuropressFileParser(FileParser):
if
encoding
!=
"utf-8"
:
if
encoding
!=
"utf-8"
:
try
:
try
:
contents
=
contents
.
decode
(
"latin1"
,
errors
=
'replace'
)
.
encode
(
codif
)
contents
=
contents
.
decode
(
"latin1"
,
errors
=
'replace'
)
.
encode
(
codif
)
except
:
except
Exception
as
error
:
try
:
print
(
error
)
contents
=
contents
.
decode
(
encoding
,
errors
=
'replace'
)
.
encode
(
codif
)
# try:
except
Exception
as
error
:
# contents = contents.decode(encoding, errors='replace').encode(codif)
print
(
error
)
# except Exception as error:
# print(error)
try
:
try
:
html_parser
=
etree
.
HTMLParser
(
encoding
=
codif
)
html_parser
=
etree
.
HTMLParser
(
encoding
=
codif
)
...
...
templates/home.html
View file @
1d1a297a
...
@@ -24,12 +24,16 @@
...
@@ -24,12 +24,16 @@
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"content"
>
<div
class=
"content"
>
<center>
<center>
<img
src=
"http://s3.lprs1.fr/images/2015/01/08/4429565_je-suis-charlie_545x460_autocrop.jpg"
alt=
"Je suis Charlie"
style=
"100px; height:150px"
>
<!--
<h2>Introduction Video</h2>
<h2>Introduction Video</h2>
<video width="320" height="240" controls>
<video width="320" height="240" controls>
<source src="movie.mp4" type="video/mp4">
<source src="movie.mp4" type="video/mp4">
<source src="movie.ogg" type="video/ogg">
<source src="movie.ogg" type="video/ogg">
Your browser does not support this video sorry. Try Firefox or Chromium.
Your browser does not support this video sorry. Try Firefox or Chromium.
</video>
</video>
--!>
</center>
</center>
</div>
</div>
</div>
</div>
...
...
templates/subcorpus.html
View file @
1d1a297a
...
@@ -22,7 +22,6 @@
...
@@ -22,7 +22,6 @@
{% if documents %}
{% if documents %}
<p>
Paginator stuff
</p>
<ul>
<ul>
{% for doc in documents %}
{% for doc in documents %}
{% if doc.date %}
{% if doc.date %}
...
@@ -31,4 +30,4 @@
...
@@ -31,4 +30,4 @@
{% endfor %}
{% endfor %}
</ul>
</ul>
{% endif %}
{% endif %}
\ 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