chokkan / crfsuite

CRFsuite: a fast implementation of Conditional Random Fields (CRFs)
http://www.chokkan.org/software/crfsuite/
Other
641 stars 208 forks source link

improving template rendering speed in `example/crfutils.py`. #80

Closed fseasy closed 7 years ago

fseasy commented 7 years ago

by replace "p not in range(len(X))" with " p < 0 or p >= len(X)", avoid creating a list(in Python2) and iterating comparing. as instance, for 420K lines input data, speed up from 59s to 20s.


Attention: it is a fix for example/crfsuites.py, which is just a utils to generate training data according to the template, not the main program.

usptact commented 7 years ago

@chokkan bump!

chokkan commented 7 years ago

Thank you for sending the PR.