Example #1
0
 def featurise(self, document, sentence, annotation):
     span_text = sentence.annotation_text(annotation)
     before_head, _, after_head = find_np_head(span_text)
     for tok_i, tok in enumerate(reversed(before_head.split(' ')), start=1):
         if tok_i > 3:
             break
         yield ('-BEFORE-{}-{}'.format(tok_i, tok), 1)
     for tok_i, tok in enumerate(after_head.split(' '), start=1):
         if tok_i > 3:
             break
         yield ('-AFTER-{}-{}'.format(tok_i, tok), 1)
Example #2
0
 def featurise(self, document, sentence, annotation):
     span_text = sentence.annotation_text(annotation)
     before_head, _, after_head = find_np_head(span_text)
     for tok_i, tok in enumerate(reversed(before_head.split(' ')), start=1):
         if tok_i > 3:
             break
         yield ('-BEFORE-{}-{}'.format(tok_i, tok), 1)
     for tok_i, tok in enumerate(after_head.split(' '), start=1):
         if tok_i > 3:
             break
         yield ('-AFTER-{}-{}'.format(tok_i, tok), 1)
Example #3
0
 def featurise(self, document, sentence, annotation):
     span_text = sentence.annotation_text(annotation)
     yield (find_np_head(span_text)[1], 1)
Example #4
0
 def featurise(self, document, sentence, annotation):
     span_text = sentence.annotation_text(annotation)
     yield (find_np_head(span_text)[1], 1)