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
1651a82f
Commit
1651a82f
authored
Nov 04, 2014
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FEATURE] Europresse parser: language from parent Node.
parent
87df8fc9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
models.py
node/models.py
+5
-2
No files found.
node/models.py
View file @
1651a82f
...
...
@@ -144,8 +144,10 @@ class Node(CTENode):
if
ngramscaches
is
None
:
ngramscaches
=
NgramsCaches
()
# what do we want from the cache?
extractor
=
ngramsextractorscache
[
self
.
language
]
ngrams
=
ngramscaches
[
self
.
language
]
language
=
self
.
language
if
self
.
language
else
self
.
parent
.
language
#print(language.fullname)
extractor
=
ngramsextractorscache
[
language
]
ngrams
=
ngramscaches
[
language
]
# find & count all the occurrences
associations
=
defaultdict
(
float
)
# float or int?
if
isinstance
(
keys
,
dict
):
...
...
@@ -158,6 +160,7 @@ class Node(CTENode):
for
ngram
in
extractor
.
extract_ngrams
(
self
.
metadata
[
key
]):
terms
=
' '
.
join
([
token
for
token
,
tag
in
ngram
])
associations
[
terms
]
+=
1
print
(
associations
)
# insert the occurrences in the database
Node_Ngram
.
objects
.
bulk_create
([
Node_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