Pull request - SimpleTagger

My fork: https://github.com/tayl0395/Mallet

In this case, the fix is for software used for sequence tagging in MALLET using a Conditional Random Field (CRF), SimpleTagger. Once a model is trained, an input file to be tagged is fed into the system for tagging. However, the software does not check at all whether the file is in the correct format, only whether a file has been fed in at all (handled via exception). After that, even if the file format is incorrect, the CRF will happily tag whatever is fed in even if tagging is erroneous and won't tell you.

The class I edited is resident in the cc.mallet.fst package and is called 'SimpleTagger.java'. It extends several classes including CRF.java and is used for simple binary (on/off) tagging. It can be found here:

https://github.com/tayl0395/Mallet/blob/master/src/cc/mallet/fst/SimpleTagger.java

Essentially, the fix detects whether there is a space between words in the input file (say, if sentences were accidentally inputted). This should not be the case, the input file should generally be one word/sequence, one line as the tagger only tags one sequence at a time. e.g.

I
ate
uh
jerry
.

Any other input format is erroneous.

Test cases can be found here:

https://github.com/tayl0395/Mallet/blob/master/src/cc/mallet/fst/tests/SE3Tests.java

Tests are a mix of detecting whether the input file is in/correct, repeating the same with very large files (stress) and tests to ensure that, were an input file in the correct format used, console output shows correct tagging. There is also a test where an extremely large training file was used to train the CRF (found here: https://cs.uwaterloo.ca/~ppoupart//teaching/cs886-fall13/assignments/asst2/ner.txt)