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
a6c3442f
Commit
a6c3442f
authored
Jul 27, 2016
by
c24b
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
load corresponding parser
parent
d1484156
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
ngrams_extraction.py
gargantext/util/toolchain/ngrams_extraction.py
+2
-2
parsing.py
gargantext/util/toolchain/parsing.py
+4
-2
No files found.
gargantext/util/toolchain/ngrams_extraction.py
View file @
a6c3442f
...
@@ -50,12 +50,12 @@ def extract_ngrams(corpus, keys=('title', 'abstract', ), do_subngrams = DEFAULT_
...
@@ -50,12 +50,12 @@ def extract_ngrams(corpus, keys=('title', 'abstract', ), do_subngrams = DEFAULT_
resource_type_index
=
corpus
.
resources
()[
0
][
'type'
]
resource_type_index
=
corpus
.
resources
()[
0
][
'type'
]
documents_count
=
0
documents_count
=
0
resource_type
=
RESOURCETYPES
[
resource_type_index
]
resource_type
=
RESOURCETYPES
[
resource_type_index
]
default_language_iso2
=
resource_type
[
'default_language'
]
default_language_iso2
=
resource_type
[
'default_language
s
'
]
for
documents_count
,
document
in
enumerate
(
corpus
.
children
(
'DOCUMENT'
)):
for
documents_count
,
document
in
enumerate
(
corpus
.
children
(
'DOCUMENT'
)):
# get ngrams extractor for the current document
# get ngrams extractor for the current document
language_iso2
=
document
.
hyperdata
.
get
(
'language_iso2'
,
default_language_iso2
)
language_iso2
=
document
.
hyperdata
.
get
(
'language_iso2'
,
default_language_iso2
)
try
:
try
:
# this looks for a
pars
er in constants.LANGUAGES
# this looks for a
tagg
er in constants.LANGUAGES
ngramsextractor
=
ngramsextractors
[
language_iso2
]
ngramsextractor
=
ngramsextractors
[
language_iso2
]
except
KeyError
:
except
KeyError
:
# skip document
# skip document
...
...
gargantext/util/toolchain/parsing.py
View file @
a6c3442f
from
gargantext.util.db
import
*
from
gargantext.util.db
import
*
from
gargantext.models
import
*
from
gargantext.models
import
*
from
gargantext.constants
import
*
from
gargantext.constants
import
*
from
gargantext.util.parsers
import
*
from
collections
import
defaultdict
from
collections
import
defaultdict
from
re
import
sub
from
re
import
sub
...
@@ -19,7 +19,9 @@ def parse(corpus):
...
@@ -19,7 +19,9 @@ def parse(corpus):
# information about the resource
# information about the resource
if
resource
[
'extracted'
]:
if
resource
[
'extracted'
]:
continue
continue
resource_parser
=
RESOURCETYPES
[
resource
[
'type'
]][
'parser'
]
#source store available module for a resource
source
=
get_resource
(
resource
[
"type"
])
resource_parser
=
load_parser
(
source
)
resource_path
=
resource
[
'path'
]
resource_path
=
resource
[
'path'
]
# extract and insert documents from corpus resource into database
# extract and insert documents from corpus resource into database
for
hyperdata
in
resource_parser
(
resource_path
):
for
hyperdata
in
resource_parser
(
resource_path
):
...
...
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