From 594034c5a9bc898eba3160b2c47c9705f51e6955 Mon Sep 17 00:00:00 2001 From: Carlos Vega <carlos.vega@uni.lu> Date: Tue, 19 Nov 2019 17:43:43 +0100 Subject: [PATCH] fixed imports and renamed folders --- interface/__init__.py | 0 {jensenlab-service => jensenLabService}/__init__.py | 0 .../jensenLabService.py | 12 ++++++++---- 3 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 interface/__init__.py rename {jensenlab-service => jensenLabService}/__init__.py (100%) rename {jensenlab-service => jensenLabService}/jensenLabService.py (85%) diff --git a/interface/__init__.py b/interface/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/jensenlab-service/__init__.py b/jensenLabService/__init__.py similarity index 100% rename from jensenlab-service/__init__.py rename to jensenLabService/__init__.py diff --git a/jensenlab-service/jensenLabService.py b/jensenLabService/jensenLabService.py similarity index 85% rename from jensenlab-service/jensenLabService.py rename to jensenLabService/jensenLabService.py index d59666f..a30eeaa 100644 --- a/jensenlab-service/jensenLabService.py +++ b/jensenLabService/jensenLabService.py @@ -4,7 +4,8 @@ from typing import List import requests -from TextMiningService import TextMiningService, Publication +from interface.TextMiningService import TextMiningService +from models.publication import Publication logger = logging.getLogger(__name__) @@ -30,7 +31,8 @@ class JensenLabService(TextMiningService): else: limit_per_entity = JensenLabService.LIMIT_PER_ENTITY 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) return [Publication(pm_id=pid) for pid in publications_ids_intersection][0:limit] @@ -54,7 +56,8 @@ class JensenLabService(TextMiningService): @staticmethod 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) assert results.ok publications_string = results.content.decode().strip() @@ -65,5 +68,6 @@ class JensenLabService(TextMiningService): if __name__ == '__main__': text_mining_service = JensenLabService() 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])) -- GitLab