decode_span_type='FOS', decode_span=span, mask_propmt_text='Field of Study:', debug=False) print('%s probability: %.4f' % (span.ljust(30), span_prob)) print() # decode a list of Field-Of-Study using beam search concepts = [] print('=== Generated FOS ===') for i in range(4): candidates = [] for span_length in range(1, 5): results = model.decode_beamsearch(title=title, abstract=abstract, authors=[], concepts=concepts, decode_span_type='FOS', decode_span_length=span_length, beam_width=8, force_forward=False) candidates.append(results[0]) candidates.sort(key=lambda x: -x[1]) span, prob = candidates[0] print("%2d. %s %s" % (i + 1, span, colored( '[%s]' % (','.join(['%s(%.4f)' % (k, v) for k, v in candidates])), 'blue'))) concepts.append(span)
debug=False, ) print("%s probability: %.4f" % (span.ljust(30), span_prob)) print() # decode a list of Field-Of-Study using beam search concepts = [] print("=== Generated FOS ===") for i in range(16): candidates = [] for span_length in range(1, 5): results = model.decode_beamsearch( title=title, abstract=abstract, authors=[], concepts=concepts, decode_span_type="FOS", decode_span_length=span_length, beam_width=8, force_forward=False, ) candidates.append(results[0]) candidates.sort(key=lambda x: -x[1]) span, prob = candidates[0] print("%2d. %s %s" % (i + 1, span, colored( "[%s]" % (",".join(["%s(%.4f)" % (k, v) for k, v in candidates])), "blue"))) concepts.append(span)
decode_span=span, mask_propmt_text="Field of Study:", debug=False, ) print("%s probability: %.4f" % (span.ljust(30), span_prob)) print() # decode a list of Field-Of-Study using beam search concepts = [] print("=== Generated FOS ===") for i in range(4): candidates = [] for span_length in range(1, 5): results = model.decode_beamsearch( title=title, abstract=abstract, authors=[], concepts=concepts, decode_span_type="FOS", decode_span_length=span_length, beam_width=8, force_forward=False, ) candidates.append(results[0]) candidates.sort(key=lambda x: -x[1]) span, prob = candidates[0] print( "%2d. %s %s" % (i + 1, span, colored("[%s]" % (",".join(["%s(%.4f)" % (k, v) for k, v in candidates])), "blue")) ) concepts.append(span)