@@ -14,31 +14,31 @@ def _doc2features(doc, i):
1414 curr_word = doc [i ][0 ]
1515 curr_pos = doc [i ][1 ]
1616 features = {
17- "word.word " : curr_word ,
18- "word.isspace " : curr_word .isspace (),
19- "word.isdigit() " : curr_word .isdigit (),
20- "postag " : curr_pos ,
17+ "word.curr_word " : curr_word ,
18+ "word.curr_isspace " : curr_word .isspace (),
19+ "word.curr_isdigit " : curr_word .isdigit (),
20+ "word.curr_postag " : curr_pos ,
2121 }
2222
2323 # features from previous word
2424 if i > 0 :
2525 prev_word = doc [i - 1 ][0 ]
2626 prev_pos = doc [i - 1 ][1 ]
27- features ["word.prevword " ] = prev_word
28- features ["word.previsspace " ] = prev_word .isspace ()
29- features ["word.prevwordisdigit " ] = prev_word .isdigit ()
30- features ["word.prepostag " ] = prev_pos
27+ features ["word.prev_word " ] = prev_word
28+ features ["word.prev_isspace " ] = prev_word .isspace ()
29+ features ["word.prev_isdigit " ] = prev_word .isdigit ()
30+ features ["word.prev_postag " ] = prev_pos
3131 else :
3232 features ["BOS" ] = True # Beginning of Sequence
3333
3434 # features from next word
3535 if i < len (doc ) - 1 :
3636 next_word = doc [i + 1 ][0 ]
3737 next_pos = doc [i + 1 ][1 ]
38- features ["word.nextword " ] = next_word
39- features ["word.nextisspace " ] = next_word .isspace ()
40- features ["word.nextwordisdigit " ] = next_word .isdigit ()
41- features ["word.nextpostag " ] = next_pos
38+ features ["word.next_word " ] = next_word
39+ features ["word.next_isspace " ] = next_word .isspace ()
40+ features ["word.next_isdigit " ] = next_word .isdigit ()
41+ features ["word.next_postag " ] = next_pos
4242 else :
4343 features ["EOS" ] = True # End of Sequence
4444
0 commit comments