for length, tags in hits: first_token_idx = i + 1 - length triggers.append( (tokens[first_token_idx][0], tokens[i][1], tags)) return triggers @processor( name='biomedicus-negex-triggers', human_name='Negex Triggers Tagger', description='Labels phrases which are negation triggers.', entry_point=__name__, parameters=[ parameter( name='terms_index', data_type='str', description= 'The label index containing terms that should be checked for negation' ) ], inputs=[ label_index(name='sentences', reference='biomedicus-sentences/sentences'), label_index(name='umls_terms', reference='biomedicus-concepts/umls_terms', name_from_parameter='terms_index') ], outputs=[ label_index("negation_trigger", description="Spans of phrases that trigger negation.", properties=[ label_property(
from typing import Dict, Any, Optional import mtap from mtap.events import Document from mtap.processing import DocumentProcessor, run_processor from mtap.processing.descriptions import label_index, label_property, parameter @mtap.processor( 'mtap-example-processor-python', human_name="Python Example Processor", description= "counts the number of times the letters a and b occur in a document", parameters=[ parameter('do_work', required=True, data_type='bool', description="Whether the processor should do anything.") ], outputs=[ label_index('mtap.examples.letter_counts', properties=[ label_property('letter', data_type='str'), label_property('count', data_type='int') ]) ]) class ExampleProcessor(DocumentProcessor): """Does some labeling of the counts of the letter 'a' and 'b' in a document. """ def process_document(self, document: Document, params: Dict[str, Any]) -> Optional[Dict[str, Any]]: if params['do_work']:
import grpc import grpc_testing import pytest from mtap import processor, Document from mtap.api.v1 import processing_pb2 from mtap.processing import DocumentProcessor, _runners from mtap.processing.descriptions import parameter, labels, label_property from mtap.processing._service import _ProcessorServicer @processor('mtap-test-processor', description='Processor desc.', parameters=[ parameter('a_param', required=True, data_type='bool', description="desc.") ], inputs=[ labels('input_index', properties=[label_property('bar', data_type='bool')]) ], outputs=[ labels('output_index', description='desc.', properties=[ label_property('foo', data_type='str', nullable=True, description='A label property.') ])
f (~typing.Union[~pathlib.Path, str, ~io.IOBase]): The file to load from. client (~typing.Optional[EventsClient]): The events service to load the event into. Returns: Event: The loaded event object. """ ... @processor( 'mtap-serializer', description='Serializes events to a specific directory', parameters=[ parameter( 'filename', data_type='str', description='Optional override for the filename to write the ' 'document to.') ]) class SerializationProcessor(EventProcessor): """An MTAP :obj:`EventProcessor` that serializes events to a specific directory. Args: ser (Serializer): The serializer to use. output_dir (str): The output_directory. """ def __init__(self, ser: Serializer, output_dir: str, include_label_text: bool = False): self.serializer = ser