Exemplo n.º 1
0
        return result

    for file_name in os.listdir(data_path):
        inf = open(os.path.join(data_path, file_name), "r")
        ouf = open(os.path.join(output_path, file_name), "w")

        fact = []

        for line in inf:
            fact.append(json.loads(line)["fact"])
            if len(fact) == get_batch():
                result = solve(fact)
                cnt += len(result)
                for x in result:
                    print(json.dumps(x), file=ouf)
                fact = []

        if len(fact) != 0:
            result = solve(fact)
            cnt += len(result)
            for x in result:
                print(json.dumps(x), file=ouf)
            fact = []
        inf.close()
        ouf.close()

    jud = Judger(accusation_path='/home/wshong/Downloads/cail_0518/accu.txt',
                 law_path='/home/wshong/Downloads/cail_0518/law.txt')
    res = jud.test(truth_path=data_path, output_path=output_path)
    jud.get_score(result=res)
Exemplo n.º 2
0
from judger.judger import Judger

INPUT = 'input/small/'
OUTPUT = 'output/'
jud = Judger('accu.txt', 'law.txt')
res = jud.test(INPUT, OUTPUT)
print(res)
scor = jud.get_score(res)
print(scor)
print('FIN')