Skip to main content

A Python client for Sherlok

Project description

Sherlok is a flexible and powerful open source, distributed, real-time text-mining engine.

pip install --upgrade sherlok

from sherlok import Sherlok

s = Sherlok('neuroner')

# returns a list of tuples (begin, end, text, annotation_type, attributes{})
print s.annotate('layer 4 neuron')

[(0, 14, 'layer 4 neuron', u'Neuron', {}),
 (8, 14, 'neuron',  u'Neuron', {}),
 (8, 14, 'neuron',  u'NeuronTrigger', {}),
 (0, 7,  'layer 4', u'Layer', {u'ontologyId': u'HBP_LAYER:0000004'})]


# filtering and finding the text back
txt = 'parvalbumin-positive fast-spiking basket cells, somatostatin-positive regular-spiking bipolar and multipolar cells, and cholecystokinin-positive irregular-spiking bipolar and multipolar cells'
morphology = s.annotate(txt, u'Morphology')
for (start, end, text, _type, properties) in morphology:
    print text, properties[u'ontologyId']

basket HBP_MORPHOLOGY:0000019
bipolar HBP_MORPHOLOGY:0000006
multipolar HBP_MORPHOLOGY:0000035
bipolar HBP_MORPHOLOGY:0000006
multipolar HBP_MORPHOLOGY:0000035

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sherlok-0.1.6.tar.gz (2.8 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page