Search in sources :

Example 1 with JSONArray

use of twitter4j.JSONArray in project Anserini by castorini.

the class TopicPoller method writeTRECTopicToDisk.

public static void writeTRECTopicToDisk(TRECTopic trecTopic) throws JSONException, IOException {
    // TODO Auto-generated method stub
    JSONObject obj = new JSONObject();
    obj.put("index", trecTopic.topid);
    obj.put("query", trecTopic.title);
    obj.put("narr", trecTopic.narrative);
    obj.put("desc", trecTopic.description);
    /*
     * It is at participants' discretion on how to utilize the interest profile
     * and implement proper query expansion module
     */
    obj.put("expansion", new JSONArray());
    try (FileWriter topicFile = new FileWriter(TRECSearcher.interestProfilePath + trecTopic.topid + ".json")) {
        topicFile.write(obj.toString());
        LOG.info("Successfully wrote interest profile " + trecTopic.topid + " to disk.");
        topicFile.close();
    }
}
Also used : JSONObject(twitter4j.JSONObject) FileWriter(java.io.FileWriter) JSONArray(twitter4j.JSONArray)

Aggregations

FileWriter (java.io.FileWriter)1 JSONArray (twitter4j.JSONArray)1 JSONObject (twitter4j.JSONObject)1