Commit b09df773 authored by Mathieu Rodic's avatar Mathieu Rodic

[GIT] Merged conflicts with master

parent e5c57cba
__pycache__/ __pycache__/
parsing/Taggers/treetagger/ parsing/Taggers/treetagger/
.ipynb_checkpoints/ .ipynb_checkpoints/
<<<<<<< HEAD
*.pyc *.pyc
=======
data_samples data_samples
VENV VENV
>>>>>>> master
...@@ -69,11 +69,7 @@ def create_whitelist(user, corpus, size=100): ...@@ -69,11 +69,7 @@ def create_whitelist(user, corpus, size=100):
return white_list return white_list
#def create_cooc(user, corpus, whitelist, blacklist, synonymes): #def create_cooc(user, corpus, whitelist, blacklist, synonymes):
<<<<<<< HEAD
def create_cooc(user=None, corpus=None, whitelist=None, size=150):
=======
def create_cooc(user=None, corpus=None, whitelist=None, size=150, year_start=None, year_end=None): def create_cooc(user=None, corpus=None, whitelist=None, size=150, year_start=None, year_end=None):
>>>>>>> master
cursor = connection.cursor() cursor = connection.cursor()
try: try:
...@@ -137,11 +133,7 @@ def create_cooc(user=None, corpus=None, whitelist=None, size=150, year_start=Non ...@@ -137,11 +133,7 @@ def create_cooc(user=None, corpus=None, whitelist=None, size=150, year_start=Non
cursor.execute(query_cooc) cursor.execute(query_cooc)
return cooc return cooc
<<<<<<< HEAD
def get_cooc(request=None, corpus_id=None, cooc_id=None, type="node_link"):
=======
def get_cooc(request=None, corpus_id=None, cooc_id=None, type=None, n=150): def get_cooc(request=None, corpus_id=None, cooc_id=None, type=None, n=150):
>>>>>>> master
import pandas as pd import pandas as pd
from copy import copy from copy import copy
import numpy as np import numpy as np
...@@ -160,14 +152,6 @@ def get_cooc(request=None, corpus_id=None, cooc_id=None, type=None, n=150): ...@@ -160,14 +152,6 @@ def get_cooc(request=None, corpus_id=None, cooc_id=None, type=None, n=150):
if Node.objects.filter(type=type_cooc, parent=corpus).first() is None: if Node.objects.filter(type=type_cooc, parent=corpus).first() is None:
print("Coocurrences do not exist yet, create it.") print("Coocurrences do not exist yet, create it.")
<<<<<<< HEAD
if type == "node_link":
n = 150
elif type == "adjacency":
n = 50
=======
>>>>>>> master
whitelist = create_whitelist(request.user, corpus, size=n) whitelist = create_whitelist(request.user, corpus, size=n)
cooccurrence_node = create_cooc(user=request.user, corpus=corpus, whitelist=whitelist, size=n) cooccurrence_node = create_cooc(user=request.user, corpus=corpus, whitelist=whitelist, size=n)
print(cooccurrence_node.id, "Cooc created") print(cooccurrence_node.id, "Cooc created")
...@@ -185,11 +169,7 @@ def get_cooc(request=None, corpus_id=None, cooc_id=None, type=None, n=150): ...@@ -185,11 +169,7 @@ def get_cooc(request=None, corpus_id=None, cooc_id=None, type=None, n=150):
weight[cooccurrence.ngramx.terms] = weight.get(cooccurrence.ngramx.terms, 0) + cooccurrence.score weight[cooccurrence.ngramx.terms] = weight.get(cooccurrence.ngramx.terms, 0) + cooccurrence.score
<<<<<<< HEAD
df = pd.DataFrame(matrix).T.fillna(0)
=======
df = pd.DataFrame(matrix).fillna(0) df = pd.DataFrame(matrix).fillna(0)
>>>>>>> master
x = copy(df.values) x = copy(df.values)
x = x / x.sum(axis=1) x = x / x.sum(axis=1)
...@@ -209,16 +189,10 @@ def get_cooc(request=None, corpus_id=None, cooc_id=None, type=None, n=150): ...@@ -209,16 +189,10 @@ def get_cooc(request=None, corpus_id=None, cooc_id=None, type=None, n=150):
partition = best_partition(G) partition = best_partition(G)
<<<<<<< HEAD
if type == "node_link":
=======
if type == "node_link": if type == "node_link":
for community in set(partition.values()): for community in set(partition.values()):
#print(community) #print(community)
G.add_node("cluster " + str(community), hidden=1) G.add_node("cluster " + str(community), hidden=1)
>>>>>>> master
for node in G.nodes(): for node in G.nodes():
try: try:
#node,type(labels[node]) #node,type(labels[node])
...@@ -226,11 +200,7 @@ def get_cooc(request=None, corpus_id=None, cooc_id=None, type=None, n=150): ...@@ -226,11 +200,7 @@ def get_cooc(request=None, corpus_id=None, cooc_id=None, type=None, n=150):
G.node[node]['name'] = node G.node[node]['name'] = node
G.node[node]['size'] = weight[node] G.node[node]['size'] = weight[node]
G.node[node]['group'] = partition[node] G.node[node]['group'] = partition[node]
<<<<<<< HEAD
#G.add_edge(node, partition[node], weight=3)
=======
G.add_edge(node, "cluster " + str(partition[node]), weight=3) G.add_edge(node, "cluster " + str(partition[node]), weight=3)
>>>>>>> master
# G.node[node]['color'] = '19,180,300' # G.node[node]['color'] = '19,180,300'
except Exception as error: except Exception as error:
print(error) print(error)
......
...@@ -237,17 +237,8 @@ def project(request, project_id): ...@@ -237,17 +237,8 @@ def project(request, project_id):
) )
try: try:
<<<<<<< HEAD
#corpus.parse_resources.apply_async((), countdown=1)
corpus.parse_resources()
# async
corpus.children.filter(type_id=type_document.pk).extract_ngrams(keys=['title',])
#corpus.children.filter(type_id=type_document.pk).extract_ngrams(keys=['title',])
=======
corpus.parse_and_extract_ngrams() corpus.parse_and_extract_ngrams()
#corpus.parse_and_extract_ngrams.apply_async((), countdown=3) #corpus.parse_and_extract_ngrams.apply_async((), countdown=3)
>>>>>>> master
except Exception as error: except Exception as error:
print(error) print(error)
...@@ -476,10 +467,6 @@ def send_csv(request, corpus_id): ...@@ -476,10 +467,6 @@ def send_csv(request, corpus_id):
return response return response
<<<<<<< HEAD
=======
>>>>>>> master
# To get the data # To get the data
from gargantext_web.api import JsonHttpResponse from gargantext_web.api import JsonHttpResponse
from analysis.functions import get_cooc from analysis.functions import get_cooc
...@@ -513,7 +500,6 @@ def graph_it(request): ...@@ -513,7 +500,6 @@ def graph_it(request):
})) }))
return HttpResponse(html) return HttpResponse(html)
<<<<<<< HEAD
def tests_mvc(request): def tests_mvc(request):
'''Just a test page for Javascript MVC.''' '''Just a test page for Javascript MVC.'''
t = get_template('tests/mvc.html') t = get_template('tests/mvc.html')
...@@ -525,8 +511,6 @@ def tests_mvc(request): ...@@ -525,8 +511,6 @@ def tests_mvc(request):
})) }))
return HttpResponse(html) return HttpResponse(html)
=======
>>>>>>> master
def ngrams(request): def ngrams(request):
'''The ngrams list.''' '''The ngrams list.'''
t = get_template('ngrams.html') t = get_template('ngrams.html')
......
...@@ -59,7 +59,6 @@ Populate the database ...@@ -59,7 +59,6 @@ Populate the database
python manage.py syncdb python manage.py syncdb
<<<<<<< HEAD
Last steps of configuration Last steps of configuration
--------------------------- ---------------------------
...@@ -95,6 +94,7 @@ Last steps of configuration ...@@ -95,6 +94,7 @@ Last steps of configuration
Extras Extras
======= =======
Last steps of configuration: Last steps of configuration:
---------------------------- ----------------------------
...@@ -126,10 +126,6 @@ patch /srv/gargantext_env/lib/python3.4/site-packages/cte_tree/models.py /srv/ga ...@@ -126,10 +126,6 @@ patch /srv/gargantext_env/lib/python3.4/site-packages/cte_tree/models.py /srv/ga
/srv/gargantext/manage.py shell < /srv/gargantext/init/init.py /srv/gargantext/manage.py shell < /srv/gargantext/init/init.py
Extras:
>>>>>>> master
======
Start the Python Notebook server Start the Python Notebook server
-------------------------------- --------------------------------
......
...@@ -30,8 +30,5 @@ sudo apt-get install libopenblas-dev ...@@ -30,8 +30,5 @@ sudo apt-get install libopenblas-dev
sudo apt-get install liblapack-dev sudo apt-get install liblapack-dev
<<<<<<< HEAD
=======
source /srv/gargantext_env/bin/activate source /srv/gargantext_env/bin/activate
pip install git+https://github.com/mathieurodic/aldjemy.git pip3 install git+https://github.com/mathieurodic/aldjemy.git
>>>>>>> master
...@@ -6,11 +6,7 @@ Pillow==2.5.3 ...@@ -6,11 +6,7 @@ Pillow==2.5.3
Pygments==1.6 Pygments==1.6
SQLAlchemy==0.9.8 SQLAlchemy==0.9.8
South==1.0 South==1.0
<<<<<<< HEAD
# aldjemy==0.3.51 # aldjemy==0.3.51
=======
aldjemy==0.3.10
>>>>>>> master
amqp==1.4.6 amqp==1.4.6
anyjson==0.3.3 anyjson==0.3.3
billiard==3.3.0.18 billiard==3.3.0.18
......
...@@ -129,11 +129,7 @@ ...@@ -129,11 +129,7 @@
<ol> <ol>
<li><a href="/corpus/{{ corpus.id }}/matrix">Adjacency matrix</a></li> <li><a href="/corpus/{{ corpus.id }}/matrix">Adjacency matrix</a></li>
<li><a href="/corpus/{{ corpus.id }}/explorer">Static maps</a></li> <li><a href="/corpus/{{ corpus.id }}/explorer">Static maps</a></li>
<<<<<<< HEAD
<li>Dynamics maps</li>
=======
<li>Dynamic maps</li> <li>Dynamic maps</li>
>>>>>>> master
</ol> </ol>
</div> </div>
</div> </div>
......
...@@ -5,11 +5,7 @@ ...@@ -5,11 +5,7 @@
{% load staticfiles %} {% load staticfiles %}
<link rel="stylesheet" href="{% static "css/bootstrap.css" %}"> <link rel="stylesheet" href="{% static "css/bootstrap.css" %}">
<link rel="stylesheet" href="{% static "css/bootstrap-theme.min.css" %}"> <link rel="stylesheet" href="{% static "css/bootstrap-theme.min.css" %}">
<<<<<<< HEAD
<link rel="stylesheet" href="{% static "css/d3matrix.css" %}">
=======
<!-- <link rel="stylesheet" href="{% static "css/d3matrix.css" %}"> --> <!-- <link rel="stylesheet" href="{% static "css/d3matrix.css" %}"> -->
>>>>>>> master
<style> <style>
.background { .background {
...@@ -37,23 +33,19 @@ text.active { ...@@ -37,23 +33,19 @@ text.active {
</div> </div>
</div> </div>
<<<<<<< HEAD
=======
<div class="container"> <div class="container">
>>>>>>> master <div id="graphid" style="visibility: hidden;">/corpus/{{ corpus.id }}/adjacency.json</div>
<div id="graphid" style="visibility: hidden;">/corpus/{{ corpus.id }}/adjacency.json</div>
<script src="{% static "js/jquery/jquery.min.js" %}" type="text/javascript"></script> <script src="{% static "js/jquery/jquery.min.js" %}" type="text/javascript"></script>
<script src="{% static "js/d3/d3.v2.min.js" %}"></script> <script src="{% static "js/d3/d3.v2.min.js" %}"></script>
<p>Order: <select id="order"> <p>Order: <select id="order">
<option value="name">by Name</option> <option value="name">by Name</option>
<option value="count">by Frequency</option> <option value="count">by Frequency</option>
<option value="group">by Cluster</option> <option value="group">by Cluster</option>
</select> </select>
</p> </p>
</div> </div>
...@@ -70,20 +62,13 @@ var x = d3.scale.ordinal().rangeBands([0, width]), ...@@ -70,20 +62,13 @@ var x = d3.scale.ordinal().rangeBands([0, width]),
var svg = d3.select("body").append("svg") var svg = d3.select("body").append("svg")
.attr("width", width + margin.left + margin.right) .attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom) .attr("height", height + margin.top + margin.bottom)
<<<<<<< HEAD
//.style("margin-left", -margin.left + "px")
=======
.style("margin-left", "25%") .style("margin-left", "25%")
>>>>>>> master
.append("g") .append("g")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")"); .attr("transform", "translate(" + margin.left + "," + margin.top + ")");
var filename = document.getElementById("graphid").innerHTML var filename = document.getElementById("graphid").innerHTML
d3.json(filename, function(miserables) { d3.json(filename, function(miserables) {
<<<<<<< HEAD
=======
>>>>>>> master
var matrix = [], var matrix = [],
nodes = miserables.nodes, nodes = miserables.nodes,
n = nodes.length; n = nodes.length;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment