The TREC Microblog Track is, for the second year running, using a unique “evaluation as a service” model. I decided I’d invest a little bit of time and create a Go library for those of us who use Go and take part in the track (which I imagine is probably only me).
Getting Started
Before you can use the library, you’ll need to download and install the Thrift library for Go. Ofcourse, because it’s Go, the go get command can deal with that for us:
go get git.apache.org/thrift.git/lib/go/thrift
You can find the library on the MIR Git server, or to get started quickly, use the go get command to install the library:
go get mirgit.dcs.gla.ac.uk/JamesMcMinn/twitter-tools-go
Basic Example
The library is modelled loosely on the official Microblog track client, which is written in Java. It’s very simple and implements 3 basic actions: 1) Create a connection 2) Perform a query and return results and 3) Close the connection. All of these are demonstrated in the example below.
main.go
package main
import (
"fmt"
"log"
"mirgit.dcs.gla.ac.uk/JamesMcMinn/twitter-tools-go"
)
func main() {
// Create a new client using the settings in conf.json
client, err := twittertools.NewClientFromConf("conf.json")
if err != nil {
log.Fatal(err)
}
defer client.Close()
// query the server for "glasgow", retreive the top 50 results
// -1 signifies that there is no maximum tweet ID
results, err := client.Search("Glasgow", 50, -1)
if err != nil {
log.Fatal(err)
}
// Iterate over the results, printing text from each tweet
for k, result := range results {
fmt.Println(k, result.Text)
}
}
The example uses a conf.json file (example below) to load the server details and your team details. If you’d rather hard-code the values, the twittertools.NewClientFromDetails(host, port, group, token) function allows you to create a new client and specify the details manually.
These details are unique to your team and should have been provided when you registered for TREC. If you haven’t already registered, there’s always next year!
conf.json
{
"Host": "server.address.edu",
"Port": 9091,
"Group": "UrTeamName",
"Token": "de4db33f"
}
Pingback: I made some Go bindings for the TREC Microblog Tra… | James McMinn
Pingback: Maria Smith
Pingback: Cialis generico online
Pingback: Online viagra
Pingback: Cialis 5mg
Pingback: Viagra viagra levitra
Pingback: Cialis great britain
Pingback: Cialis 20mg prix en pharmacie
Pingback: Viagra or viagra
Pingback: Generic cialis
Pingback: Cialis online
Pingback: Buy cialis
Pingback: Cialis coupon
Pingback: writeessay
Pingback: Buy cialis online
Pingback: Cialis coupon
Pingback: newtube sirius31 abdu23na5663 abdu23na68
Pingback: latestvideo sirius900 abdu23na8044 abdu23na55
Pingback: fknjn544a879 afeu23na1564 abdu23na82
Pingback: hd videos tubepla.net285 afeu23na7762 abdu23na13
Pingback: download on mobile467 afeu23na832 abdu23na4