class TestRexTagger(unittest.TestCase): def setUp(self): self.tagger = RexTagger('foo', [ r'foo', ]) def test_match(self): text = 'foo bar baz' tag = self.tagger.tag(text) assert_equal( tag, Tag({ 'label': 'foo', 'context': 'foo bar baz', 'span': (0, 3), }))
'eprime', [ r'\We{dlm}prime'.format(dlm=delimiter), ], version_separator, looks=Looks(negahead=r'(\w|\.[1-9])'), versions=[ '1', '1.1', '1.2', '2', ], ) presentation = RexTagger('presentation', [ r'neuro{dlm}bs'.format(dlm=delimiter), r'neuro{dlm}behavioral{dlm}systems'.format(dlm=delimiter), ]) psychtoolbox = RexTagger('psychtoolbox', [ r'psychtoolbox', r'psychophysics{dlm}toolbox'.format(dlm=delimiter), ]) psychopy = RexTagger('psychopy', [ r'\Wpsychopy\W', ]) visionegg = RexTagger('visionegg', [ r'vision{dlm}egg'.format(dlm=delimiter), ])
version_separator, arbitrary_rex=r'(?P<version>\d(\.\d)+)', post_proc=post_proc, ) voyager = RexComboVersionTagger( 'voyager', [r'brain{dlm}voyager{dlm}(2000|qx)?'.format(dlm=delimiter)], version_separator, arbitrary_rex=r'(?P<version>\d\.\d)', post_proc=post_proc, ) suma = RexTagger( 'suma', [ r'\Wsuma\W', ], ) medx = RexTagger( 'medx', [ r'\Wmedx[^a-z]', ], ) caret = RexTagger( 'caret', [ r'caret', r'surefit', r''' computerized{dlm}anatomical{dlm}reconstruction{dlm}
category = 'analysis' from neurotrends.tagger import RexTagger, MultiRexTagger from .misc import delimiter from neurotrends.config import re event = RexTagger( 'event', [ r'null{dlm}event'.format(dlm=delimiter), r'null{dlm}trial'.format(dlm=delimiter), r'fixation{dlm}event'.format(dlm=delimiter), r'fixation{dlm}trial'.format(dlm=delimiter), r''' separating{dlm}processes{dlm}within{dlm}a{dlm}trial{dlm}in{dlm} event{dlm}related{dlm}functional{dlm}mri '''.format(dlm=delimiter), r''' a{dlm}trial{dlm}based{dlm}experimental{dlm}design{dlm}for{dlm}fmri '''.format(dlm=delimiter), ] ) event_context = MultiRexTagger( 'event', [ r'event{dlm}related{dlm}design'.format(dlm=delimiter), r'event{dlm}related{dlm}analysis'.format(dlm=delimiter), r'event{dlm}related{dlm}fmri'.format(dlm=delimiter), r'event{dlm}related{dlm}task'.format(dlm=delimiter),
# -*- coding: utf-8 -*- category = 'tool' import os from neurotrends.config import re from neurotrends.tagger import Looks, RexTagger, RexComboVersionTagger from neurotrends.pattern.misc import delimiter, version_separator from neurotrends import trendpath from .matlab_utils import get_versions, get_version_regexes python = RexTagger('python', [r'python']) java = RexTagger('java', [ r'java(?!{dlm}script)'.format(dlm=delimiter), ]) rlang = RexTagger('rlang', [ r'\Wr{dlm}project'.format(dlm=delimiter), r'\Wr{dlm}development{dlm}(core)?{dlm}team'.format(dlm=delimiter), r''' \Wr{dlm}foundation{dlm}for{dlm}statistical{dlm}computing '''.format(dlm=delimiter), r''' (software|programming){dlm}(language|environment){dlm}r(?!\w) '''.format(dlm=delimiter), r''' \Wr{dlm}(software|programming){dlm}(language|senvironment) '''.format(dlm=delimiter),
""" from neurotrends.config import re from neurotrends.tagger import RexTagger, MultiRexTagger from ..misc import delimiter, float_ptn, mov_ptn, cor_ptn num_ptn = r'\d*\.?\d+' mm_ptn = r'(mm|milli{dlm}met(er|re)s?)'.format(dlm=delimiter) fw_ptn = r'(fwhm|full{dlm}width)'.format(dlm=delimiter) hm_ptn = r'(fwhm|half{dlm}max(imum)?)'.format(dlm=delimiter) power = RexTagger( 'power', [ r'power{dlm}analysis'.format(dlm=delimiter), r'power{dlm}calculation'.format(dlm=delimiter), r'sample{dlm}size{dlm}calculation'.format(dlm=delimiter), ] ) desopt = RexTagger( 'desopt', [ r'design{dlm}optimi[sz]ation'.format(dlm=delimiter), r'optimization{dlm}of{dlm}experimental{dlm}design'.format( dlm=delimiter ), r'\Wm{dlm}sequence'.format(dlm=delimiter), r'optseq', ] )
def setUp(self): self.tagger = RexTagger('foo', [ r'foo', ])
category = 'analysis' from neurotrends.config import re from neurotrends.tagger import RexTagger, MultiRexTagger from misc import delimiter fdr = RexTagger('fdr', [ r'false{dlm}discovery{dlm}rate'.format(dlm=delimiter), r'\Wfdr\W', ]) fwe = RexTagger('fwe', [ r'family{dlm}wise{dlm}error'.format(dlm=delimiter), r'\Wfwe\w', ]) rft = RexTagger( 'rft', [ r'random{dlm}field{dlm}theory'.format(dlm=delimiter), r'gaussian{dlm}random{dlm}field'.format(dlm=delimiter), r'\Wgrf{dlm}theory'.format(dlm=delimiter), r'theory{dlm}of{dlm}random{dlm}fields'.format(dlm=delimiter), # Worsley et al., 1992 r''' a{dlm}three{dlm}dimensional{dlm}statistical{dlm}analysis{dlm} for{dlm}cbf{dlm}activation{dlm}studies{dlm}in{dlm}human {dlm}brain '''.format(dlm=delimiter), # Friston et al., 1994 r'''
cat = 'analysis' from neurotrends.tagger import RexTagger from misc import delimiter, mni_ptn, mni_num_ptn, spc_ptn mni = RexTagger('mni', [ mni_num_ptn + delimiter + spc_ptn, r'{spc}{dlm}of{dlm}the{dlm}{mni}'.format( spc=spc_ptn, mni=mni_ptn, dlm=delimiter, ), ]) tal = RexTagger('tal', [ r'talairach{dlm}{spc}'.format( spc=spc_ptn, dlm=delimiter, ), ])
category = 'tool' from neurotrends.config import re from neurotrends.tagger import RexTagger, MultiRexTagger from misc import delimiter ### Sequences ### mprage = RexTagger('mprage', [ r'\Wmp{dlm}rage\W'.format(dlm=delimiter), ]) spgr = RexTagger('spgr', [ r'\Wspgr\W', ]) ### Trajectories ### epi = RexTagger('epi', [ r'echo{dlm}planar'.format(dlm=delimiter), re.compile(r'EPI'), ]) spiral = RexTagger('spiral', [ r'spiral{dlm}in'.format(dlm=delimiter), r'spiral{dlm}out'.format(dlm=delimiter), ]) spiral_context = MultiRexTagger('spiral', [ r'spiral',
from neurotrends.tagger import RexTagger, MultiRexTagger from misc import delimiter os_secondary_ptn = [ r'\Wpc\W', r'\Wos\W', r'operating', r'platform', r'environment', r'workstation', ] mac = RexTagger( 'mac', [ re.compile(r'OS[-/\s]*X'), r'\Wmac{dlm}os\W'.format(dlm=delimiter), r'spss{dlm}for{dlm}mac'.format(dlm=delimiter), ] ) mac_context = MultiRexTagger( 'mac', [ r'apple', r'mac(intosh)?', ], os_secondary_ptn, separator='[^.,:;?]*' ) windows_context = MultiRexTagger(
# -*- coding: utf-8 -*- from neurotrends.config import re from neurotrends.tagger import RexTagger, MultiRexTagger from ..misc import delimiter ge = RexTagger('ge', [ r'general{dlm}electric'.format(dlm=delimiter), ]) # Use MultiRexTagger for GE to disambiguate names: e.g. GE Smith ge_context = MultiRexTagger('ge', [ re.compile(r'\bGE\b'), ], [ r'mri', r'scan', r'tesla', ]) siemens = RexTagger('siemens', [r'siemens']) philips = RexTagger('philips', [r'philips']) bruker = RexTagger('bruker', [r'bruker']) varian = RexTagger('varian', [r'varian\W']) shimazdu = RexTagger('shimadzu', [r'shimazdu']) marconi = RexTagger('marconi', [r'marconi'])
category = 'tool' from neurotrends.config import re from neurotrends.tagger import RexTagger from misc import delimiter, mni_ptn, spc_ptn marsbar = RexTagger('marsbar', [ r'mars{dlm}bar'.format(dlm=delimiter), r'sourceforge\.net/projects/marsbar', r''' marseille{dlm}region{dlm}of{dlm}interest{dlm}toolbox '''.format(dlm=delimiter), ]) pickatlas = RexTagger('pickatlas', [ r'\Wpick{dlm}atlas'.format(dlm=delimiter), ]) surfrend = RexTagger('surfrend', [ r'\Wsurf{dlm}rend'.format(dlm=delimiter), ]) rest = RexTagger('rest', [ r'resting{dlm}state{dlm}fmri{dlm}data{dlm}analysis{dlm}toolkit'.format( dlm=delimiter), r'rest{dlm}(by)?{dlm}song{dlm}xiao'.format(dlm=delimiter), r'resting\-fmri\.sourceforge\.net', r'sourceforge\.net/projects/resting\-fmri', r'restfmri\.net', ])
category = 'analysis' from neurotrends.config import re from neurotrends.tagger import RexTagger, MultiRexTagger from misc import delimiter syn_ptn = r'(spm|canonical|standard|synthetic|reference|(proto)?typical)' hrf_ptn = r'(hrf|hdr|ha?emodynamic{dlm}(impulse)?{dlm}response)'.format( dlm=delimiter) selavg = RexTagger('selavg', [ r'selective(ly)?{dlm}averag'.format(dlm=delimiter), ]) hrf = RexTagger('hrf', [ syn_ptn + delimiter + hrf_ptn, r''' convol(ved?|ution){dlm}with{dlm}(an?|the){dlm} {syn}?{dlm}{hrf} '''.format( syn=syn_ptn, hrf=hrf_ptn, dlm=delimiter, ), r'gamma{dlm}{hrf}'.format( hrf=hrf_ptn, dlm=delimiter, ), r'(single|first|positive){dlm}gamma{dlm}function'.format(dlm=delimiter), r'(double|second){dlm}gamma'.format(dlm=delimiter),
category = 'analysis' from neurotrends.config import re from neurotrends.tagger import RexTagger, MultiRexTagger from misc import delimiter kda = RexTagger( 'kda', [ re.compile(r'\WKDA\W'), ] ) kda_context = MultiRexTagger( 'kda', [ r'kernel{dlm}density{dlm}analysis'.format(dlm=delimiter), ], [ r'multi{dlm}level'.format(dlm=delimiter), ], separator='[^.,:;?]*' ) mkda = RexTagger( 'mkda', [ r''' multi{dlm}level{dlm}kernel{dlm}density{dlm}analysis '''.format(dlm=delimiter), r'multi{dlm}level{dlm}kda'.format(dlm=delimiter),