def worker(doc): rouge = Rouge(use_ngram_buf=True) comb = solve_one(doc, rouge) return comb
import sys import itertools import gc import math import datetime sys.path.append('/idiap/temp/jbello/others/') from PyRouge.Rouge.Rouge import Rouge sys.path.append('/idiap/temp/jbello/others/') from Document import Document rouge = Rouge(use_ngram_buf=True) MAX_COMB_L = 5 MAX_COMB_NUM = 100000 def c_n_x(n, x): if x > (n >> 2): x = n - x res = 1 for i in range(n, n - x, -1): res *= i for i in range(x, 0, -1): res = res // i return res def solve_one(document): if document.doc_len == 0 or document.summary_len == 0: return None, 0