# Path: indra/sources/eidos/client.py
# def process_text(text, webservice):
# 
# Path: indra/sources/eidos/bio_processor.py
# class EidosBioProcessor(EidosProcessor):
#     """Class to extract biology-oriented INDRA statements from Eidos output
#     in a way that agents are grounded to biomedical ontologies."""
# 
#     def __init__(self, json_dict, grounder: Optional[Grounder] = None):
#         super().__init__(json_dict)
#         if grounder:
#             self.grounder = grounder
#         else:
#             self.grounder = default_grounder_wrapper
# 
#     def get_regulate_activity(self, stmt):
#         context = stmt.evidence[0].text
#         subj = self.get_agent_bio(stmt.subj.concept, context=context)
#         obj = self.get_agent_bio(stmt.obj.concept, context=context)
#         if not subj or not obj:
#             return None
#         pol = stmt.overall_polarity()
#         stmt_type = Activation if pol == 1 or not pol else Inhibition
#         bio_stmt = stmt_type(subj, obj, evidence=stmt.evidence)
#         return bio_stmt
# 
#     def extract_statements(self):
#         self.extract_causal_relations()
#         bio_stmts = []
#         for stmt in self.statements:
#             bio_stmt = self.get_regulate_activity(stmt)
#             if bio_stmt:
#                 bio_stmts.append(bio_stmt)
#         self.statements = bio_stmts
# 
#     def get_agent_bio(self, concept, context=None):
#         return get_agent_bio(concept, context=context, grounder=self.grounder)


import json
import logging
from indra.sources.eidos import client as eidos_client
from .bio_processor import EidosBioProcessor
    from .reader import EidosReader
    from indra.sources.eidos.bio_processor import EidosBioProcessor
    from .bio_processor import get_agent_bio
    -------
    ep : EidosProcessor
        A EidosProcessor containing the extracted INDRA Statements
        in its statements attribute.
    """
    ep = EidosBioProcessor(json_dict, grounder=grounder)
    ep.extract_statements()
    return ep


def process_json_bio_entities(json_dict, grounder=None):
    """Return INDRA Agents grounded to biological ontologies extracted
    from Eidos JSON-LD.

    Parameters
    ----------
    json_dict : dict
        The JSON-LD dict to be processed.
    grounder : Optional[function]
        A function which takes a text and an optional context as argument
        and returns a dict of groundings.

    Returns
    -------
    list of indra.statements.Agent
        A list of INDRA Agents which are derived from concepts extracted
        by Eidos from text.
    """
    if not json_dict:
        return []

# Path: indra/sources/eidos/client.py
# def process_text(text, webservice):
# 
# Path: indra/sources/eidos/bio_processor.py
# class EidosBioProcessor(EidosProcessor):
#     """Class to extract biology-oriented INDRA statements from Eidos output
#     in a way that agents are grounded to biomedical ontologies."""
# 
#     def __init__(self, json_dict, grounder: Optional[Grounder] = None):
#         super().__init__(json_dict)
#         if grounder:
#             self.grounder = grounder
#         else:
#             self.grounder = default_grounder_wrapper
# 
#     def get_regulate_activity(self, stmt):
#         context = stmt.evidence[0].text
#         subj = self.get_agent_bio(stmt.subj.concept, context=context)
#         obj = self.get_agent_bio(stmt.obj.concept, context=context)
#         if not subj or not obj:
#             return None
#         pol = stmt.overall_polarity()
#         stmt_type = Activation if pol == 1 or not pol else Inhibition
#         bio_stmt = stmt_type(subj, obj, evidence=stmt.evidence)
#         return bio_stmt
# 
#     def extract_statements(self):
#         self.extract_causal_relations()
#         bio_stmts = []
#         for stmt in self.statements:
#             bio_stmt = self.get_regulate_activity(stmt)
#             if bio_stmt:
#                 bio_stmts.append(bio_stmt)
#         self.statements = bio_stmts
# 
#     def get_agent_bio(self, concept, context=None):
#         return get_agent_bio(concept, context=context, grounder=self.grounder)


# Path: indra/sources/eidos/api.py
import json
import logging
from indra.sources.eidos import client as eidos_client
from .bio_processor import EidosBioProcessor
    from .reader import EidosReader
    from indra.sources.eidos.bio_processor import EidosBioProcessor
    from .bio_processor import get_agent_bio

    -------
    ep : EidosProcessor
        A EidosProcessor containing the extracted INDRA Statements
        in its statements attribute.
    """
    ep = EidosBioProcessor(json_dict, grounder=grounder)
    ep.extract_statements()
    return ep


def process_json_bio_entities(json_dict, grounder=None):
    """Return INDRA Agents grounded to biological ontologies extracted
    from Eidos JSON-LD.

    Parameters
    ----------
    json_dict : dict
        The JSON-LD dict to be processed.
    grounder : Optional[function]
        A function which takes a text and an optional context as argument
        and returns a dict of groundings.

    Returns
    -------
    list of indra.statements.Agent
        A list of INDRA Agents which are derived from concepts extracted
        by Eidos from text.
    """
    if not json_dict:
        return []

    ep = EidosBioProcessor(json_dict, grounder=grounder)