Conditions | 5 |
Total Lines | 13 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | """Collection of language-specific analyzers and analyzer registry for Annif""" |
||
21 | |||
22 | def get_analyzer(analyzerspec): |
||
23 | match = re.match(r'(\w+)(\((.*)\))?', analyzerspec) |
||
24 | if match is None: |
||
25 | raise ValueError( |
||
26 | "Invalid analyzer specification {}".format(analyzerspec)) |
||
27 | |||
28 | analyzer = match.group(1) |
||
29 | posargs, kwargs = parse_args(match.group(3)) |
||
30 | posargs = _extend_posargs(posargs) |
||
31 | try: |
||
32 | return _analyzers[analyzer](*posargs, **kwargs) |
||
33 | except KeyError: |
||
34 | raise ValueError("No such analyzer {}".format(analyzer)) |
||
46 |