from dotenv import load_dotenv
from sqlalchemy import create_engine
from sqlalchemy.orm import subqueryload
from cdcrapp.services import UserService, TaskService
from cdcrapp.model import Task, NewsArticle, SciPaper, UserTask

# %%


def get_sql_engine():
    return create_engine(os.getenv("SQLALCHEMY_DB_URI"))


load_dotenv()
_engine = get_sql_engine()
_usersvc: UserService = UserService(_engine)
_tasksvc: TaskService = TaskService(_engine)

# %%
# collect sets of documents that our task should be limited to
# the 'definitive' CD^2CR corpus is from 31/7/20
sci_docs = []
news_docs = []

for seg in ['dev', 'test', 'train']:
    with open(f"mentions/31_07_20_5pc/{seg}_entities.json") as f:
        data = json.load(f)

    for ent in data:
        _, doc_type, doc_id = ent['doc_id'].split("_")
Пример #2
0
 def __init__(self):
     self.engine: Engine = create_engine(os.getenv("SQLALCHEMY_DB_URI"))
     self.usersvc: UserService = UserService(self.engine)
     self.tasksvc: TaskService = TaskService(self.engine)