changed line == '\n' to line.strip() == ''
added support for four rare word classes