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
a4c676fe
Commit
a4c676fe
authored
Mar 05, 2015
by
PkSM3
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[UPDATE] good version :)
parent
31fd980b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
db.py
gargantext_web/db.py
+2
-2
corpustools.py
parsing/corpustools.py
+2
-1
No files found.
gargantext_web/db.py
View file @
a4c676fe
...
@@ -134,8 +134,8 @@ class ModelCache(dict):
...
@@ -134,8 +134,8 @@ class ModelCache(dict):
for
column
in
self
.
_columns
for
column
in
self
.
_columns
if
key
.
__class__
==
column
.
type
.
python_type
if
key
.
__class__
==
column
.
type
.
python_type
]
]
if
len
(
conditions
)
==
0
:
#
if len(conditions) == 0:
raise
KeyError
#
raise KeyError
element
=
session
.
query
(
self
.
_model
)
.
filter
(
or_
(
*
conditions
))
.
first
()
element
=
session
.
query
(
self
.
_model
)
.
filter
(
or_
(
*
conditions
))
.
first
()
if
element
is
None
:
if
element
is
None
:
raise
KeyError
raise
KeyError
...
...
parsing/corpustools.py
View file @
a4c676fe
...
@@ -195,6 +195,7 @@ class NgramsExtractors(defaultdict):
...
@@ -195,6 +195,7 @@ class NgramsExtractors(defaultdict):
ngramsextractors
=
NgramsExtractors
()
ngramsextractors
=
NgramsExtractors
()
def
extract_ngrams
(
corpus
,
keys
):
def
extract_ngrams
(
corpus
,
keys
):
print
(
"yoloo"
)
dbg
=
DebugTime
(
'Corpus #
%
d - ngrams'
%
corpus
.
id
)
dbg
=
DebugTime
(
'Corpus #
%
d - ngrams'
%
corpus
.
id
)
default_language_iso2
=
None
if
corpus
.
language_id
is
None
else
cache
.
Language
[
corpus
.
language_id
]
.
iso2
default_language_iso2
=
None
if
corpus
.
language_id
is
None
else
cache
.
Language
[
corpus
.
language_id
]
.
iso2
# query the metadata associated with the given keys
# query the metadata associated with the given keys
...
@@ -224,7 +225,7 @@ def extract_ngrams(corpus, keys):
...
@@ -224,7 +225,7 @@ def extract_ngrams(corpus, keys):
ngramsextractor
=
ngramsextractors
[
language_iso2
]
ngramsextractor
=
ngramsextractors
[
language_iso2
]
for
text
in
nodeinfo
[
2
:]:
for
text
in
nodeinfo
[
2
:]:
if
text
is
not
None
and
len
(
text
):
if
text
is
not
None
and
len
(
text
):
ngrams
=
ngramsextractor
.
extract_ngrams
(
text
)
ngrams
=
ngramsextractor
.
extract_ngrams
(
text
.
replace
(
"["
,
""
)
.
replace
(
"]"
,
""
)
)
for
ngram
in
ngrams
:
for
ngram
in
ngrams
:
terms
=
' '
.
join
([
token
for
token
,
tag
in
ngram
])
.
lower
()
terms
=
' '
.
join
([
token
for
token
,
tag
in
ngram
])
.
lower
()
n
=
len
(
ngram
)
n
=
len
(
ngram
)
...
...
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