Skip to content

Commit

Permalink
Merge pull request #39 from kowey/doc
Browse files Browse the repository at this point in the history
[MRG + 1] attelo.decoding.util doc fixes
  • Loading branch information
kowey committed Jun 2, 2015
2 parents 8236a93 + a050785 commit 03de6a1
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions attelo/decoding/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from attelo.table import (Graph, UNRELATED)


class DecoderException(Exception):
"""
Exceptions that arise during the decoding process
Expand Down Expand Up @@ -45,11 +46,8 @@ def get_prob_map(instances):


def convert_prediction(dpack, triples):
"""
Convert the given predictions into a DataPack where
each predicted edge is assigned an attachment
score of 1.0 (and the others 0.0), and likewise for
its label
"""Populate a datapack prediction array from a list
of triples
Parameters
----------
Expand All @@ -59,9 +57,12 @@ def convert_prediction(dpack, triples):
Returns
-------
dpack: A new DataPack
dpack: DataPack
A copy of the original DataPack with predictions
set
"""
link_map = {(id1, id2): lab for id1, id2, lab in triples}

def get_lbl(pair):
'from edu pair to label number'
edu1, edu2 = pair
Expand Down Expand Up @@ -92,6 +93,7 @@ def simple_candidates(dpack):
for pair, score, lbl
in zip(dpack.pairings, wts.attach, best_lbls)]


def prediction_to_triples(dpack):
"""
Returns
Expand Down

0 comments on commit 03de6a1

Please sign in to comment.