On this page you can download a special version of AnyBURL-RE, which allows you to convert a AnyBRUL prediction file, which looks like this:
/m/07cn2c /people/person/place_of_birth /m/03902 Heads: /m/01vh096 0.014441475920054382 /m/02wh0 0.014441475914088744 /m/081k8 0.014441339107235808 /m/05qmj 0.01444133910127017 /m/04xjp 0.01444133910127017 /m/06kb_ 0.01444043321299639 /m/02lt8 0.01444043321299639 /m/03j0d 0.01444043321299639 /m/03f70xs 0.01444043321299639 /m/05np2 0.01444043321299639 Tails: /m/052p7 0.08065425831923294 /m/0cr3d 0.06875 /m/02_286 0.0661345496009122 /m/02dtg 0.04225352112676056 /m/03l2n 0.04225352112676056 /m/030qb3t 0.031097560975609756 /m/0d060g 0.029180176007410838 /m/0694j 0.029180176007410838 /m/01_d4 0.028506271379703536 /m/04f_d 0.017543859649122806 ...
to this format
/m/01vh096 /people/person/place_of_birth /m/03902 0.014441475920054382 /m/02wh0 /people/person/place_of_birth /m/03902 0.014441475914088744 /m/081k8 /people/person/place_of_birth /m/03902 0.014441339107235808 /m/05qmj /people/person/place_of_birth /m/03902 0.01444133910127017 ... /m/07cn2c /people/person/place_of_birth /m/052p7 0.08065425831923294 /m/07cn2c /people/person/place_of_birth /m/0cr3d 0.06875 /m/07cn2c /people/person/place_of_birth /m/02_286 0.0661345496009122 /m/07cn2c /people/person/place_of_birth /m/02dtg 0.04225352112676056 /m/07cn2c /people/person/place_of_birth /m/03l2n 0.04225352112676056 /m/07cn2c /people/person/place_of_birth /m/030qb3t 0.031097560975609756 ...
You can download a jar, or built it on your own from the source code.
Then you can write a class like this one and compile and run it with the jar in the class path.
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import de.unima.ki.anyburl.eval.CompletionResult;
import de.unima.ki.anyburl.eval.ResultSet;
public class Predictions2Triples {
public static void main(String[] args) throws FileNotFoundException {
String inputPath = "predictions.txt";
String outputPath = "triples.txt";
ResultSet rs = new ResultSet(inputPath, true, 10);
rs.printAsWeightedTripleSet(outputPath);
// rs.printAsTripleSet(outputPath); // without confidences
}
}
The second parameter of the ResultSet constructor should be true (default) if the ResultSet contains confidences (as shown in the example above). The third parameter informs about the top-k triples that should be extracted (default for a prediction file is 10). You can create the triple set with or without confidences (out commented line).
... back to the home of AnyBURL