science_live.pipeline#

Science Live Pipeline: 7-Step Natural Language Processing Pipeline#

This package implements a 7-step pipeline for processing natural language questions and converting them to structured queries against nanopub networks:

  1. QuestionProcessor - Parse and classify questions

  2. EntityExtractorLinker - Extract and link entities

  3. RosettaStatementGenerator - Generate Rosetta statements

  4. SPARQLGenerator - Convert to SPARQL queries

  5. QueryExecutor - Execute queries

  6. ResultProcessor - Structure results

  7. NaturalLanguageGenerator - Generate natural language responses

Usage: # Individual components from science_live.pipeline import QuestionProcessor processor = QuestionProcessor()

# Complete pipeline
from science_live.pipeline import ScienceLivePipeline
pipeline = ScienceLivePipeline(endpoint_manager)
result = await pipeline.process("Your question here")

# Custom pipeline
from science_live.pipeline import create_custom_pipeline
custom_pipeline = create_custom_pipeline([
    QuestionProcessor(),
    EntityExtractorLinker(endpoint_manager),
    # ... other steps
])

Submodules#

Package Contents#

Functions#

get_pipeline_status

Get status of pipeline components

event_loop

Create an instance of the default event loop for the test session.

processing_context

Create a basic processing context for tests.

mock_endpoint_manager

Create a mock endpoint manager for testing.

sample_extracted_entities

Create sample extracted entities for testing.

sample_sparql_results

Create sample SPARQL results for testing.

pytest_configure

Configure pytest with custom markers.

pytest_runtest_setup

Skip tests that require unavailable components.

Data#

API#

science_live.pipeline._COMPONENTS_AVAILABLE = None#
science_live.pipeline.__all__ = []#
science_live.pipeline.get_pipeline_status()#

Get status of pipeline components

science_live.pipeline.__version__ = '1.0.0'#
science_live.pipeline.__author__ = 'Science Live Team'#
science_live.pipeline.__description__ = 'Semantic knowledge exploration for scientific research'#
science_live.pipeline.event_loop()#

Create an instance of the default event loop for the test session.

science_live.pipeline.processing_context()#

Create a basic processing context for tests.

science_live.pipeline.mock_endpoint_manager()#

Create a mock endpoint manager for testing.

science_live.pipeline.sample_extracted_entities()#

Create sample extracted entities for testing.

science_live.pipeline.sample_sparql_results()#

Create sample SPARQL results for testing.

science_live.pipeline.pytest_configure(config)#

Configure pytest with custom markers.

science_live.pipeline.pytest_runtest_setup(item)#

Skip tests that require unavailable components.