Uploaded image for project: 'Stanbol'
  1. Stanbol
  2. STANBOL-892

RESTful Service Specification for Stanbol NLP analysis

    Details

      Description

      This Issue will specify a RESTful service for Natural Language Processing compatible to the Stanbol NLP processing Module (STANBOL-733).

      The service will be based on the JSON serialisation for the AnalysedText ContentPart (STANBOL-878)

        Activity

        Hide
        rwesten Rupert Westenthaler added a comment -

        specified by the 1st comment to this issue

        Show
        rwesten Rupert Westenthaler added a comment - specified by the 1st comment to this issue
        Hide
        rwesten Rupert Westenthaler added a comment -
          1. Service specification
            1. Supported languages
        • Method: GET {service-baseuri}
          * Headers: none
          * Parameters: none
          * Response: JSON array with the supported languages

          _Example:_

          A simple GET request to the {service-baseuri}

        curl GET http://localhost:8081/analysis

        will return a JSON Array with the supported languages

        ["en","de","it"]

            1. Analysis Service
        • Method: POST {service-baseuri}
        • Request Headers:
        • Content-Type: Must be `plain/text; charset= {charset}

          `. If the charset parameter is missing that `UTF-8` is used as default.

        • Content-Language: Used to parse the language of the text. If not present the service MAY try to detect the language. If this is not possible/supported a BAD_REQUEST will be issued as response
        • Response Headers:
        • Content-Language: The language of the analysed text.
        • Response: The JSON serialized Text as implemented by STANBOL-878

        _Example_

        A POST request with a `Content-Language` header and `plain/text` as content

        curl -i -X POST -H "Content-Type: text/plain" -H "Content-Language: ru" -T ru.txt http://localhost:8080/analysis

        will return an JSON serialised AnalyzedText ContentPart as generated by the Serializer part of the `org.apache.stanbol.enhancer.nlp.json` module.

        <code>
        HTTP/1.1 200 OK
        Content-Type: application/json
        Content-Language: ru
        Transfer-Encoding: chunked
        Server: Jetty(6.0.x)

        {
        "spans" : [

        { "type" : "Text", "start" : 0, "end" : 1130 }

        ,

        { "type" : "Sentence", "start" : 0, "end" : 211 }

        , {
        "type" : "Token",
        "start" : 0,
        "end" : 1,
        "stanbol.enhancer.nlp.pos" :

        { "tag" : "Fra", "pos" : 125, "class" : "org.apache.stanbol.enhancer.nlp.pos.PosTag", "prob" : 1.0 }

        }, {
        "type" : "Token",
        "start" : 1,
        "end" : 6,
        "stanbol.enhancer.nlp.pos" :

        { "tag" : "NC", "pos" : 45, "class" : "org.apache.stanbol.enhancer.nlp.pos.PosTag", "prob" : 1.0 }

        },
        [...]
        </code>

        Show
        rwesten Rupert Westenthaler added a comment - Service specification Supported languages Method: GET {service-baseuri} * Headers: none * Parameters: none * Response: JSON array with the supported languages _ Example: _ A simple GET request to the {service-baseuri} curl GET http://localhost:8081/analysis will return a JSON Array with the supported languages ["en","de","it"] Analysis Service Method: POST {service-baseuri} Request Headers: Content-Type: Must be `plain/text; charset= {charset} `. If the charset parameter is missing that `UTF-8` is used as default. Content-Language: Used to parse the language of the text. If not present the service MAY try to detect the language. If this is not possible/supported a BAD_REQUEST will be issued as response Response Headers: Content-Language: The language of the analysed text. Response: The JSON serialized Text as implemented by STANBOL-878 _ Example _ A POST request with a `Content-Language` header and `plain/text` as content curl -i -X POST -H "Content-Type: text/plain" -H "Content-Language: ru" -T ru.txt http://localhost:8080/analysis will return an JSON serialised AnalyzedText ContentPart as generated by the Serializer part of the `org.apache.stanbol.enhancer.nlp.json` module. <code> HTTP/1.1 200 OK Content-Type: application/json Content-Language: ru Transfer-Encoding: chunked Server: Jetty(6.0.x) { "spans" : [ { "type" : "Text", "start" : 0, "end" : 1130 } , { "type" : "Sentence", "start" : 0, "end" : 211 } , { "type" : "Token", "start" : 0, "end" : 1, "stanbol.enhancer.nlp.pos" : { "tag" : "Fra", "pos" : 125, "class" : "org.apache.stanbol.enhancer.nlp.pos.PosTag", "prob" : 1.0 } }, { "type" : "Token", "start" : 1, "end" : 6, "stanbol.enhancer.nlp.pos" : { "tag" : "NC", "pos" : 45, "class" : "org.apache.stanbol.enhancer.nlp.pos.PosTag", "prob" : 1.0 } }, [...] </code>

          People

          • Assignee:
            rwesten Rupert Westenthaler
            Reporter:
            rwesten Rupert Westenthaler
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development