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
9fcf90b5
Commit
9fcf90b5
authored
Jul 27, 2016
by
c24b
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
load corresponding parser
parent
1ed99fcc
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 @
9fcf90b5
...
...
@@ -50,12 +50,12 @@ def extract_ngrams(corpus, keys=('title', 'abstract', ), do_subngrams = DEFAULT_
resource_type_index
=
corpus
.
resources
()[
0
][
'type'
]
documents_count
=
0
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'
)):
# get ngrams extractor for the current document
language_iso2
=
document
.
hyperdata
.
get
(
'language_iso2'
,
default_language_iso2
)
try
:
# this looks for a
pars
er in constants.LANGUAGES
# this looks for a
tagg
er in constants.LANGUAGES
ngramsextractor
=
ngramsextractors
[
language_iso2
]
except
KeyError
:
# skip document
...
...
gargantext/util/toolchain/parsing.py
View file @
9fcf90b5
from
gargantext.util.db
import
*
from
gargantext.models
import
*
from
gargantext.constants
import
*
from
gargantext.util.parsers
import
*
from
collections
import
defaultdict
from
re
import
sub
...
...
@@ -19,7 +19,9 @@ def parse(corpus):
# information about the resource
if
resource
[
'extracted'
]:
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'
]
# extract and insert documents from corpus resource into database
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