Exemplo n.º 1
0
    public override HoundServerJSON do_text_request(string query,
                                                    ConversationStateJSON conversation_state,
                                                    RequestInfoJSON request_info)
    {
        string url =
            text_request_url_base + "?query=" + Uri.EscapeUriString(query);
        Fetch fetcher = new Fetch(url);

        set_up_fetch(fetcher, conversation_state, request_info);
        try
        {
            HoundServerJSON.HoldingGenerator generator =
                new HoundServerJSON.HoldingGenerator(
                    "the result from the Hound server");
            ResultHandler handler = new ResultHandler(generator);
            fetcher.get(handler);
            return(generator.value);
        }
        catch (Exception e1)
        {
            Console.Error.Write("Error trying to fetch from `{0}': {1}\n", url,
                                e1.Message);
            return(null);
        }
    }
 public FieldGeneratorValue(string what, bool ignore_extras)
 {
     field0          = new HoundServerJSON.HoldingGenerator("option 0 of field \"Value\"", ignore_extras);
     field1          = new HoundPartialTranscriptJSON.HoldingGenerator("option 1 of field \"Value\"", ignore_extras);
     field2          = new HoundUpdateJSON.HoldingGenerator("option 2 of field \"Value\"", ignore_extras);
     all_handlers[0] = field0;
     all_handlers[1] = field1;
     all_handlers[2] = field2;
 }