Code and experiment for relation inference