[ 
https://issues.apache.org/jira/browse/STANBOL-892?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13558081#comment-13558081
 ] 

Rupert Westenthaler commented on STANBOL-892:
---------------------------------------------

## 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>
                
> RESTful Service Specification for Stanbol NLP analysis
> ------------------------------------------------------
>
>                 Key: STANBOL-892
>                 URL: https://issues.apache.org/jira/browse/STANBOL-892
>             Project: Stanbol
>          Issue Type: New Feature
>            Reporter: Rupert Westenthaler
>            Assignee: Rupert Westenthaler
>
> 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)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to