Comparator

API Access

This example uses the stopeight.legacy, stopeight.tests module and sample data. Please refer to Stopeight and Sample-Data on how to install them.

This attempts to load all the files with “.sp” extension into parallel implementation of stroke analyzer:

$ cd /path/to/where/stopeight
>>> from stopeight.util import parser
>>> lines = parser.process_directory('path/to/where/extracted/sample/data','.sp',legacy._parse_file,legacy.stroke_parallel)

The stopeight.multiprocessing.pooling makes parallel calls to stopeight.comparator. Note: The IDLE shell does not support spawning. Run from a Python shell instead:

>>> from stopeight.multiprocessing import pooling
>>> comparator = pooling.MPLine(lines)

It tests every line against the whole dataset and itself:

>>> for i,line in enumerate(lines):
>>>     matches = comparator.matchLine(line)
>>>     print('Line '+str(i)+' matched '+str(len(matches))+' occurences '+str(matches))