spell out tweezer parameters

git-svn-id: http://google-refine.googlecode.com/svn/trunk@1444 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
Stefano Mazzocchi 2010-10-07 08:20:46 +00:00
parent 9ea477c80d
commit 215165ed97

View File

@ -40,6 +40,9 @@ public class FreebaseUtils {
static final private String AGENT_ID = "/en/google_refine";
static final private int SAMPLE_SIZE = 300;
static final private int JUDGES = 4;
private static String getUserInfoURL(String host) {
return "http://" + host + "/api/service/user_info";
}
@ -148,6 +151,19 @@ public class FreebaseUtils {
return EntityUtils.toString(httpResponse.getEntity());
}
private static String getTweezersParams(int sample_size, int judges) {
String o = "{" +
"'sample_size':" + sample_size + "," +
"'votes':{" +
"'reconciled':" + judges + "," +
"'invalid':" + judges + "," +
"'new':" + judges + "," +
"'skip':" + (judges + 2) +
"}" +
"}";
return o.replace('\'', '"');
}
public static String uploadTriples(
HttpServletRequest request,
String qa,
@ -183,7 +199,7 @@ public class FreebaseUtils {
formparams.add(new BasicNameValuePair("mdo_guid", mdo_id));
}
if (Boolean.parseBoolean(qa)) {
formparams.add(new BasicNameValuePair("rabj", "true"));
formparams.add(new BasicNameValuePair("rabj", getTweezersParams(SAMPLE_SIZE,JUDGES)));
}
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams, "UTF-8");