Skip to content

Instantly share code, notes, and snippets.

@tomelm
Last active August 29, 2015 14:15
Show Gist options
  • Save tomelm/fed102b7a338644adba7 to your computer and use it in GitHub Desktop.
Save tomelm/fed102b7a338644adba7 to your computer and use it in GitHub Desktop.
{
"query" : "cheap restaurants",
"language" : "en",
"queryAnnotations" : [
{
"type" : "RawTokenQueryAnnotation",
"offset" : 0,
"length" : 5,
"queryText" : "cheap"
},
{
"type" : "RawTokenQueryAnnotation",
"offset" : 6,
"length" : 11,
"queryText": "restaurants"
},
{
"type" : "AttributeQueryAnnotation",
"offset" : 0,
"length" : 5,
"attribute" : "$",
"queryText" : "cheap",
"confidence" : 1.0
}
]
}
public class Soxhlet {
private final List<QueryTransformer> queryTransformers;
public RichQuery extract(PoorQuery poorQuery) {
// Step 1: Build the initial rich query.
RichQuery richQuery = new RichQuery(poorQuery);
// Step 2: Apply query transformations.
for (QueryTransformer qf : this.queryTransformers) {
richQuery = qf.transform(richQuery);
}
// Step 3: Profit.
return richQuery;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment