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
bbb9c801
Commit
bbb9c801
authored
Oct 20, 2014
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleaning unfinished work
parent
a57cf30d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
30 deletions
+31
-30
EuropressFileParser.py
parsing/FileParsers/EuropressFileParser.py
+7
-6
FileParser.py
parsing/FileParsers/FileParser.py
+11
-11
PubmedFileParser.py
parsing/FileParsers/PubmedFileParser.py
+6
-6
__init__.py
parsing/FileParsers/__init__.py
+2
-2
__init__.py
parsing/Taggers/__init__.py
+1
-1
__init__.py
parsing/__init__.py
+4
-4
No files found.
parsing/FileParsers/EuropressFileParser.py
View file @
bbb9c801
#import FileParser
class
EuropressFileParser
(
FileParser
,
contents
):
#
#class EuropressFileParser(FileParser, contents):
def
parse
:
#
pass
# def parse():
# pass
\ No newline at end of file
#
parsing/FileParsers/FileParser.py
View file @
bbb9c801
...
@@ -76,18 +76,18 @@ class FileParser:
...
@@ -76,18 +76,18 @@ class FileParser:
resource
=
Resource
(
guid
=
guid
)
resource
=
Resource
(
guid
=
guid
)
# If the parent node already has a child with this resource, pass
# If the parent node already has a child with this resource, pass
# (is it a good thing?)
# (is it a good thing?)
if
parentNode
.
get_descendants
()
.
if
parentNode
.
get_descendants
()
:
# create the document itself
# create the document itself
childNode
=
Node
(
childNode
=
Node
(
user
=
parentNode
.
pk
,
user
=
parentNode
.
pk
,
type
=
self
.
_document_nodetype
,
type
=
self
.
_document_nodetype
,
name
=
title
,
name
=
title
,
language
=
language
language
=
language
,
metadata
=
metadata
metadata
=
metadata
,
resource
=
resource
resource
=
resource
)
)
parentNode
.
add_child
(
childNode
)
parentNode
.
add_child
(
childNode
)
# parse it!
# parse it!
ngrams
=
self
.
extract_ngrams
(
contents
,
language
)
ngrams
=
self
.
extract_ngrams
(
contents
,
language
)
# we should already be in a transaction, so no use doing another one (or is there?)
# we should already be in a transaction, so no use doing another one (or is there?)
...
...
parsing/FileParsers/PubmedFileParser.py
View file @
bbb9c801
from
django.db
import
transaction
from
django.db
import
transaction
from
FileParser
import
FileParser
from
parsing.FileParsers.
FileParser
import
FileParser
class
PubmedFileParser
(
FileParser
):
class
PubmedFileParser
(
FileParser
):
...
@@ -21,18 +21,18 @@ class PubmedFileParser(FileParser):
...
@@ -21,18 +21,18 @@ class PubmedFileParser(FileParser):
# other metadata should also be included:
# other metadata should also be included:
# authors, submission date, etc.
# authors, submission date, etc.
"date_pub"
:
datetime
.
date
(
year
,
month
,
day
),
"date_pub"
:
datetime
.
date
(
year
,
month
,
day
),
"journal"
:
xml_article
.
find
(
'MedlineCitation/Article/Journal/Title'
)
.
text
"journal"
:
xml_article
.
find
(
'MedlineCitation/Article/Journal/Title'
)
.
text
,
"title"
:
xml_article
.
find
(
'MedlineCitation/Article/ArticleTitle'
)
.
text
"title"
:
xml_article
.
find
(
'MedlineCitation/Article/ArticleTitle'
)
.
text
,
"language_iso3"
:
xml_article
.
find
(
'MedlineCitation/Article/Language'
)
.
text
"language_iso3"
:
xml_article
.
find
(
'MedlineCitation/Article/Language'
)
.
text
,
"doi"
:
xml_article
.
find
(
'PubmedData/ArticleIdList/ArticleId[type=doi]'
)
.
text
"doi"
:
xml_article
.
find
(
'PubmedData/ArticleIdList/ArticleId[type=doi]'
)
.
text
}
}
contents
=
xml_article
.
find
(
'MedlineCitation/Article/Abstract/AbstractText'
)
.
text
contents
=
xml_article
.
find
(
'MedlineCitation/Article/Abstract/AbstractText'
)
.
text
# create the document in the database
# create the document in the database
yield
self
.
create_document
(
yield
self
.
create_document
(
parentNode
=
parentNode
parentNode
=
parentNode
,
title
=
metadata
[
"title"
],
title
=
metadata
[
"title"
],
contents
=
contents
,
contents
=
contents
,
language
=
self
.
_languages_iso3
[
metadata
[
"language"
]
.
lower
()]
language
=
self
.
_languages_iso3
[
metadata
[
"language"
]
.
lower
()]
,
metadata
=
metadata
,
metadata
=
metadata
,
guid
=
metadata
[
"doi"
],
guid
=
metadata
[
"doi"
],
)
)
parsing/FileParsers/__init__.py
View file @
bbb9c801
from
EuropressFileParser
import
EuropressFileParser
#from parsing.FileParsers import EuropressFileParser
from
PubmedFileParser
import
PubmedFileParser
from
parsing.FileParsers
import
PubmedFileParser
\ No newline at end of file
parsing/Taggers/__init__.py
View file @
bbb9c801
from
Taggers.NltkTagger
import
NltkTagger
from
Taggers.NltkTagger
import
NltkTagger
from
Taggers.TreeTagger
import
TreeTagger
from
Taggers.TreeTagger
import
TreeTagger
\ No newline at end of file
parsing/__init__.py
View file @
bbb9c801
from
Taggers
import
*
#from .
Taggers import *
from
NgramsExtractors
import
*
#from .
NgramsExtractors import *
from
FileParsers
import
*
from
.
FileParsers
import
*
import
zipfile
import
zipfile
import
C
ollections
import
c
ollections
# import chardet
# import chardet
...
...
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