Пример #1
0
        /**
         * Send a request with embedded plain text document,
         * Request output as GATE JSON and use the defauls set of annotation selectors.
         */
        private static void processInlineDocument()
        {
            ProcessingRequest pr = new ProcessingRequest();

            pr.document = ("Tiruchirappalli is the " +
                           "fourth largest city in the Indian state of " +
                           "Tamil Nadu and is the administrative headquarters " +
                           "of Tiruchirappalli District. Its recorded " +
                           "history begins in the 3rd century BC, " +
                           "when it was under the rule of the Cholas. " +
                           "The city has also been ruled by the Pandyas, " +
                           "Pallavas, Vijayanagar Empire, Nayak Dynasty, " +
                           "the Carnatic state and the British. " +
                           "It played a crucial role in the Carnatic Wars " +
                           "(1746–63) between the British and the French " +
                           "East India companies. During British rule, the city " +
                           "was popular for the Trichinopoly cigar, its unique brand " +
                           "of cheroot. Monuments include the Rockfort (pictured), the " +
                           "Ranganathaswamy temple and the Jambukeswarar temple. " +
                           "It is an important educational centre in Tamil Nadu, " +
                           "housing nationally recognised institutions such as the " +
                           "Indian Institute of Management and the National " +
                           "Institute of Technology.");
            pr.documentType = ("text/plain");
            apiExecutor.processRequest(pr.toJSON(), S4ServiceClient.APPLICATION_JSON_HEADER, S4ServiceClient.APPLICATION_JSON_HEADER);
        }
Пример #2
0
        /**
         * Process an HTML document by supplying its publicly accessible URL
         * Request output as GATE XML and use the default set of annotation selectors.
         */
        private static void processRemoteDocument()
        {
            ProcessingRequest pr = new ProcessingRequest();

            pr.documentUrl  = ("http://www.bbc.com/future/story/20130630-super-shrinking-the-city-car");
            pr.documentType = ("text/html");
            apiExecutor.processRequest(pr.toJSON(), S4ServiceClient.APPLICATION_JSON_HEADER, S4ServiceClient.APPLICATION_JSON_HEADER);
        }
Пример #3
0
        /**
         * Process a tweet as an embedded document
         * Request output as GATE JSON and set some custom annotation selectors
         */
        private static void processTweet()
        {
            ProcessingRequest pr = new ProcessingRequest();

            pr.document = (
                "{\"text\":\"Nearly 200,000 people have been killed in #Syria since the start of the conflict in 2011, according to the U.N. http://t.co/pK7t8AD7Xf\","
                + "\"lang\":\"en\",\"entities\":{\"symbols\":[],"
                + "\"urls\":[{\"expanded_url\":\"http://on.wsj.com/1pZmkY9\",\"indices\":[112,134],\"display_url\":\"on.wsj.com/1pZmkY9\",\"url\":\"http://t.co/pK7t8AD7Xf\"}],"
                + "\"hashtags\":[{\"text\":\"Syria\",\"indices\":[42,48]}],"
                + "\"user_mentions\":[]},"
                + "\"id\":502743846716207104,"
                + "\"created_at\":\"Fri Aug 22 09:07:28 +0000 2014\","
                + "\"id_str\":\"502743846716207104\"}");
            pr.documentType        = ("text/x-json-twitter");
            pr.annotationSelectors = (new String[] { ":", "Original markups:" });
            apiExecutor.processRequest(pr.toJSON(), S4ServiceClient.APPLICATION_JSON_HEADER, S4ServiceClient.APPLICATION_JSON_HEADER);
        }
Пример #4
0
 /**
 * Send a request with embedded plain text document,
 * Request output as GATE JSON and use the defauls set of annotation selectors.
 */
 private static void processInlineDocument()
 {
     ProcessingRequest pr = new ProcessingRequest();
     pr.document = ("Tiruchirappalli is the " +
             "fourth largest city in the Indian state of " +
             "Tamil Nadu and is the administrative headquarters " +
             "of Tiruchirappalli District. Its recorded " +
             "history begins in the 3rd century BC, " +
             "when it was under the rule of the Cholas. " +
             "The city has also been ruled by the Pandyas, " +
             "Pallavas, Vijayanagar Empire, Nayak Dynasty, " +
             "the Carnatic state and the British. " +
             "It played a crucial role in the Carnatic Wars " +
             "(1746–63) between the British and the French " +
             "East India companies. During British rule, the city " +
             "was popular for the Trichinopoly cigar, its unique brand " +
             "of cheroot. Monuments include the Rockfort (pictured), the " +
             "Ranganathaswamy temple and the Jambukeswarar temple. " +
             "It is an important educational centre in Tamil Nadu, " +
             "housing nationally recognised institutions such as the " +
             "Indian Institute of Management and the National " +
             "Institute of Technology.");
     pr.documentType = ("text/plain");
     apiExecutor.processRequest(pr.toJSON(),S4ServiceClient.APPLICATION_JSON_HEADER,S4ServiceClient.APPLICATION_JSON_HEADER);
 }
Пример #5
0
 /**
 * Process a tweet as an embedded document
 * Request output as GATE JSON and set some custom annotation selectors
 */
 private static void processTweet()
 {
     ProcessingRequest pr = new ProcessingRequest();
     pr.document = (
         "{\"text\":\"Nearly 200,000 people have been killed in #Syria since the start of the conflict in 2011, according to the U.N. http://t.co/pK7t8AD7Xf\","
         + "\"lang\":\"en\",\"entities\":{\"symbols\":[],"
         + "\"urls\":[{\"expanded_url\":\"http://on.wsj.com/1pZmkY9\",\"indices\":[112,134],\"display_url\":\"on.wsj.com/1pZmkY9\",\"url\":\"http://t.co/pK7t8AD7Xf\"}],"
         + "\"hashtags\":[{\"text\":\"Syria\",\"indices\":[42,48]}],"
         + "\"user_mentions\":[]},"
         + "\"id\":502743846716207104,"
         + "\"created_at\":\"Fri Aug 22 09:07:28 +0000 2014\","
         + "\"id_str\":\"502743846716207104\"}");
     pr.documentType = ("text/x-json-twitter");
     pr.annotationSelectors = (new String[] { ":", "Original markups:" });
     apiExecutor.processRequest(pr.toJSON(), S4ServiceClient.APPLICATION_JSON_HEADER, S4ServiceClient.APPLICATION_JSON_HEADER);
 }
Пример #6
0
 /**
 * Process an HTML document by supplying its publicly accessible URL
 * Request output as GATE XML and use the default set of annotation selectors.
 */
 private static void processRemoteDocument()
 {
     ProcessingRequest pr = new ProcessingRequest();
     pr.documentUrl = ("http://www.bbc.com/future/story/20130630-super-shrinking-the-city-car");
     pr.documentType = ("text/html");
     apiExecutor.processRequest(pr.toJSON(), S4ServiceClient.APPLICATION_JSON_HEADER, S4ServiceClient.APPLICATION_JSON_HEADER);
 }