sklearn-crfsuite icon indicating copy to clipboard operation
sklearn-crfsuite copied to clipboard

TypeError when printing model info

Open uwaisiqbal opened this issue 7 years ago • 1 comments

The library often throws this TypeError when trying to print state features of general information about the model. It seems that the internal regex match is coming back as a None which causes a NoneType error when isolating the regex groups.

This is quite annoying and something as straightforward as a mismatched regex shouldn't break the build. Is there a quick fix for this or do you have an intuition as to why the regex match is coming back with a None?

uwaisiqbal avatar Nov 01 '17 18:11 uwaisiqbal

I spent some time debugging this and it seems that whenever there is a new line character within the feature the regex fails to match it causing the TypeError. Using regex in Python the dot character doesn't include the new-line character. A quick fix would be to update the regex to ([\s\S]+) instead of of (.+)

uwaisiqbal avatar Nov 03 '17 15:11 uwaisiqbal