Example #1
0
def main(goldFile, predFile, outCSVFile, description, fieldName1, fieldValue1):
    (goldRoot, goldNodes) = evaluate.getCoarseGrainedTreeLabelsFile(goldFile)
    (predRoot, predNodes) = evaluate.getCoarseGrainedTreeLabelsFile(predFile)
    rootData = evaluate.printStatsCoarseInt(goldRoot, predRoot, prefix='root')
    nodeData = evaluate.printStatsCoarseInt(goldNodes, predNodes)
    nodeData.update(rootData)
    if description:
        nodeData = evaluate.ins(['Description'],
                                [description], nodeData)
    if fieldName1 and fieldValue1:
        nodeData = evaluate.ins([fieldName1],
                                [fieldValue1], nodeData)

    evaluate.statsToFile(nodeData, outCSVFile, delim=';')
Example #2
0
def rootAccStatistic(gold, predicted):
    # This looks somewhat convoluted - that's some legacy
    # from the CSV code.
    # combinedRootLabelAccMacro has always been used for root
    # accuracy. This method can be used to compute any
    # macro accuracy as 'root' is only symbolic,
    # but I only ever use it for root accuracy
    data = evaluate.printStatsCoarseInt(gold, predicted, prefix='root')
    return data['combinedRootLabelAccMacro']
Example #3
0
def nodeF1Statistic(gold, predicted):
    data = evaluate.printStatsCoarseInt(gold, predicted)
    return data['combinedLabelFMacro']