Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Text Mining Resources Hub
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Carlos Vega
Text Mining Resources Hub
Commits
594034c5
Commit
594034c5
authored
5 years ago
by
Carlos Vega
Browse files
Options
Downloads
Patches
Plain Diff
fixed imports and renamed folders
parent
a336c560
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
interface/__init__.py
+0
-0
0 additions, 0 deletions
interface/__init__.py
jensenLabService/__init__.py
+0
-0
0 additions, 0 deletions
jensenLabService/__init__.py
jensenLabService/jensenLabService.py
+8
-4
8 additions, 4 deletions
jensenLabService/jensenLabService.py
with
8 additions
and
4 deletions
interface/__init__.py
0 → 100644
+
0
−
0
View file @
594034c5
This diff is collapsed.
Click to expand it.
jensen
l
ab
-s
ervice/__init__.py
→
jensen
L
ab
S
ervice/__init__.py
+
0
−
0
View file @
594034c5
File moved
This diff is collapsed.
Click to expand it.
jensen
l
ab
-s
ervice/jensenLabService.py
→
jensen
L
ab
S
ervice/jensenLabService.py
+
8
−
4
View file @
594034c5
...
@@ -4,7 +4,8 @@ from typing import List
...
@@ -4,7 +4,8 @@ from typing import List
import
requests
import
requests
from
TextMiningService
import
TextMiningService
,
Publication
from
interface.TextMiningService
import
TextMiningService
from
models.publication
import
Publication
logger
=
logging
.
getLogger
(
__name__
)
logger
=
logging
.
getLogger
(
__name__
)
...
@@ -30,7 +31,8 @@ class JensenLabService(TextMiningService):
...
@@ -30,7 +31,8 @@ class JensenLabService(TextMiningService):
else
:
else
:
limit_per_entity
=
JensenLabService
.
LIMIT_PER_ENTITY
limit_per_entity
=
JensenLabService
.
LIMIT_PER_ENTITY
for
(
entity
,
entity_type
)
in
entities_and_types
:
for
(
entity
,
entity_type
)
in
entities_and_types
:
publications_ids
.
append
(
self
.
get_mentions_for_entity
(
entity
,
entity_type
,
limit
=
limit_per_entity
))
publications_ids
.
append
(
self
.
get_mentions_for_entity
(
entity
,
entity_type
,
limit
=
limit_per_entity
))
publications_ids_intersection
=
set
.
intersection
(
*
publications_ids
)
publications_ids_intersection
=
set
.
intersection
(
*
publications_ids
)
return
[
Publication
(
pm_id
=
pid
)
for
pid
in
publications_ids_intersection
][
0
:
limit
]
return
[
Publication
(
pm_id
=
pid
)
for
pid
in
publications_ids_intersection
][
0
:
limit
]
...
@@ -54,7 +56,8 @@ class JensenLabService(TextMiningService):
...
@@ -54,7 +56,8 @@ class JensenLabService(TextMiningService):
@staticmethod
@staticmethod
def
get_mentions_for_entity
(
entity
,
entity_type
,
limit
):
def
get_mentions_for_entity
(
entity
,
entity_type
,
limit
):
url_mentions
=
JensenLabService
.
MENTION_URL
.
format
(
entity_type
,
entity
,
limit
)
url_mentions
=
JensenLabService
.
MENTION_URL
.
format
(
entity_type
,
entity
,
limit
)
results
=
requests
.
get
(
url_mentions
)
results
=
requests
.
get
(
url_mentions
)
assert
results
.
ok
assert
results
.
ok
publications_string
=
results
.
content
.
decode
().
strip
()
publications_string
=
results
.
content
.
decode
().
strip
()
...
@@ -65,5 +68,6 @@ class JensenLabService(TextMiningService):
...
@@ -65,5 +68,6 @@ class JensenLabService(TextMiningService):
if
__name__
==
'
__main__
'
:
if
__name__
==
'
__main__
'
:
text_mining_service
=
JensenLabService
()
text_mining_service
=
JensenLabService
()
print
(
"
Using service {}
"
.
format
(
text_mining_service
.
name
))
print
(
"
Using service {}
"
.
format
(
text_mining_service
.
name
))
publications
=
text_mining_service
.
get_mentions
([
"
DOID:10652
"
,
"
DOID:10935
"
],
limit
=
1000000
)
publications
=
text_mining_service
.
get_mentions
(
[
"
DOID:10652
"
,
"
DOID:10935
"
],
limit
=
1000000
)
print
(
"
,
"
.
join
([
p
.
pm_id
for
p
in
publications
]))
print
(
"
,
"
.
join
([
p
.
pm_id
for
p
in
publications
]))
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment