一只蟒蛇的客户端
sherlok的Python项目详细描述
是一个灵活且功能强大的开源分布式实时文本挖掘引擎。
pipinstall--upgradesherlokfromsherlokimportSherloks=Sherlok('neuroner')# returns a list of tuples (begin, end, text, annotation_type, attributes{})prints.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 backtxt='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)inmorphology:printtext,properties[u'ontologyId']basketHBP_MORPHOLOGY:0000019bipolarHBP_MORPHOLOGY:0000006multipolarHBP_MORPHOLOGY:0000035bipolarHBP_MORPHOLOGY:0000006multipolarHBP_MORPHOLOGY:0000035