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
988f7c8d
Commit
988f7c8d
authored
Oct 21, 2015
by
PkSM3
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[BUGFIX] multiple ngrams deletion OK
parent
7414bbd9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
13 deletions
+13
-13
urls.py
annotations/urls.py
+1
-1
NGrams_dyna_chart_and_table.js
static/js/NGrams_dyna_chart_and_table.js
+3
-4
views.py
tests/ngramstable/views.py
+9
-8
No files found.
annotations/urls.py
View file @
988f7c8d
...
...
@@ -5,6 +5,6 @@ from annotations import views
urlpatterns
=
patterns
(
''
,
url
(
r'^document/(?P<doc_id>[0-9]+)$'
,
views
.
Document
.
as_view
()),
# document view
url
(
r'^corpus/(?P<corpus_id>[0-9]+)/document/(?P<doc_id>[0-9]+)$'
,
views
.
NgramList
.
as_view
()),
# the list associated with an ngram
url
(
r'^lists/(?P<list_id>[0-9]+)/ngrams/(?P<ngram_ids>[0-9]+\+*[0-9]*)$'
,
views
.
NgramEdit
.
as_view
()),
#
url
(
r'^lists/(?P<list_id>[0-9]+)/ngrams/(?P<ngram_ids>[0-9]+\+*[0-9]*)$'
,
views
.
NgramEdit
.
as_view
()),
url
(
r'^lists/(?P<list_id>[0-9]+)/ngrams/create$'
,
views
.
NgramCreate
.
as_view
()),
#
)
static/js/NGrams_dyna_chart_and_table.js
View file @
988f7c8d
...
...
@@ -397,12 +397,11 @@ $("#Save_All").click(function(){
var
list_id
=
$
(
"#list_id"
).
val
()
// '/annotations/lists/'+list_id+'/ngrams/108642'
console
.
log
(
window
.
location
.
origin
+
'/
annotations/lists/'
+
list_id
+
"/multiple"
)
console
.
log
(
window
.
location
.
origin
+
'/
lists/'
+
list_id
+
"/ngrams/"
+
real_ids
.
join
(
"+"
)
)
console
.
log
(
real_ids
)
$
.
ajax
({
method
:
"POST"
,
url
:
window
.
location
.
origin
+
'/annotations/lists/'
+
list_id
+
"/multiple"
,
data
:
"to_delete="
+
JSON
.
stringify
(
real_ids
),
method
:
"DELETE"
,
url
:
window
.
location
.
origin
+
'/annotations/lists/'
+
list_id
+
"/ngrams/"
+
real_ids
.
join
(
"+"
),
beforeSend
:
function
(
xhr
)
{
xhr
.
setRequestHeader
(
"X-CSRFToken"
,
getCookie
(
"csrftoken"
));
},
...
...
tests/ngramstable/views.py
View file @
988f7c8d
...
...
@@ -111,12 +111,8 @@ def get_ngrams(request , project_id , corpus_id ):
corpus
=
cache
.
Node
[
int
(
corpus_id
)]
type_doc_id
=
cache
.
NodeType
[
'Document'
]
.
id
number
=
session
.
query
(
func
.
count
(
Node
.
id
))
.
filter
(
Node
.
parent_id
==
corpus_id
,
Node
.
type_id
==
type_doc_id
)
.
all
()[
0
][
0
]
lists
=
dict
()
for
list_type
in
[
'MiamList'
,
'StopList'
]:
list_id
=
list
()
list_id
=
listIds
(
user_id
=
request
.
user
.
id
,
corpus_id
=
int
(
corpus_id
),
typeList
=
list_type
)
lists
[
"
%
s"
%
list_id
[
0
][
0
]]
=
list_type
myamlist_type_id
=
cache
.
NodeType
[
'MiamList'
]
.
id
miamlist
=
session
.
query
(
Node
)
.
filter
(
Node
.
user_id
==
request
.
user
.
id
,
Node
.
parent_id
==
corpus_id
,
Node
.
type_id
==
myamlist_type_id
)
.
first
()
try
:
processing
=
corpus
.
hyperdata
[
'Processing'
]
...
...
@@ -132,7 +128,7 @@ def get_ngrams(request , project_id , corpus_id ):
'corpus'
:
corpus
,
'processing'
:
processing
,
'number'
:
number
,
'list_id'
:
list_id
[
0
][
0
]
,
'list_id'
:
miamlist
.
id
,
}))
return
HttpResponse
(
html
)
...
...
@@ -245,7 +241,7 @@ def get_ngrams_json(request , project_id, corpus_id ):
# [ Get Uniq_Occs ]
myamlist_type_id
=
cache
.
NodeType
[
'MiamList'
]
.
id
myamlist
=
session
.
query
(
Node
)
.
filter
(
Node
.
user_id
==
user_id
,
Node
.
parent_id
==
corpus_id
,
Node
.
type_id
==
myamlist_type_id
)
.
first
()
myamlists
=
session
.
query
(
Node
)
.
filter
(
Node
.
user_id
==
user_id
,
Node
.
parent_id
==
corpus_id
,
Node
.
type_id
==
myamlist_type_id
)
.
all
()
# sql_average = """SELECT avg(weight) as Average FROM node_node_ngram WHERE node_node_ngram.node_id=%d""" % (myamlist.id)
# cursor = connection.cursor()
# cursor.execute(sql_average)
...
...
@@ -267,6 +263,11 @@ def get_ngrams_json(request , project_id, corpus_id ):
# print([n for n in sql_average])
OCCs
=
{}
for
ngram
in
sql_average
:
if
ngram
[
0
]
==
151483
:
print
(
"FUUUUUUUUUUUUUUUUUUUUCKKKKKKK"
)
print
(
myamlist
.
id
)
for
miam
in
myamlists
:
print
(
"
\t
"
,
miam
.
id
)
OCCs
[
ngram
[
0
]
]
=
ngram
[
1
]
...
...
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