Skip to content

Instantly share code, notes, and snippets.

@lukereding
Created June 9, 2017 13:42
Show Gist options
  • Select an option

  • Save lukereding/c939ece520cd372748290f4bef56e844 to your computer and use it in GitHub Desktop.

Select an option

Save lukereding/c939ece520cd372748290f4bef56e844 to your computer and use it in GitHub Desktop.
swagger: '2.0'
info:
description: >-
This API implments some simple natural language processing tasks like
tokenization, sentiment analysis, and retrieving parts of speech from text.
version: 2017.06.08
title: NLP with Anaconda
termsOfService: ''
contact:
email: [email protected]
license:
name: Apache 2.0
url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
host: '??'
basePath: /
tags:
- name: tokenize
description: Tokenize text.
- name: sentiment
description: Sentiment analysis of text.
- name: parts_of_speech
description: Retrieve parts of speech from text.
schemes:
- http
- https
paths:
/tokenize:
get:
tags:
- tokenize
summary: Get tokens from text.
description: ''
consumes:
- application/json
- text/plain
produces:
- application/json
parameters:
- in: body
name: data
description: Text to be tokenized.
required: true
schema:
type: object
properties:
data:
type: string
- name: unique
in: query
description: Only return unique tokens?
required: false
type: string
responses:
'200':
description: OK
schema:
type: object
properties:
tokens:
type: array
description: array of tokens in the text
'405':
description: Invalid data type
/tokenize/length:
get:
tags:
- tokenize
summary: Get number of tokens from text.
description: ''
consumes:
- application/json
- text/plain
produces:
- application/json
parameters:
- in: body
name: data
description: Text to be tokenized.
required: true
schema:
type: object
properties:
data:
type: string
- name: unique
in: query
description: Only return the number of unique tokens?
required: false
type: string
responses:
'200':
description: OK
schema:
type: object
properties:
number_tokens:
type: integer
description: number of tokens in the test
'405':
description: Invalid data type
/sentimnent:
get:
tags:
- sentiment
summary: Get the sentiment score from input text.
description: ''
consumes:
- application/json
- text/plain
produces:
- application/json
parameters:
- in: body
name: data
description: Text to be analyzed.
required: true
schema:
type: object
properties:
data:
type: string
- name: type
in: query
description: >-
The type of sentiment analyzer to use. Type = 1 (the default) uses
the implmentation from the pattern library. Type = 2 uses a Naive
Bayes classifier trained on movie reviews.
required: false
type: integer
responses:
'200':
description: OK
schema:
type: object
properties:
sentiment:
type: string
description: >-
Sentiment score. Ranges from -1 (very negative) to 1 (very
positive).
'405':
description: Invalid data type
/parts_of_speech:
get:
tags:
- parts_of_speech
summary: Gets the parts of speech from text.
description: ''
consumes:
- application/json
- text/plain
produces:
- application/json
parameters:
- in: body
name: data
description: Text to be analyzed.
required: true
schema:
type: object
properties:
data:
type: string
responses:
'200':
description: OK
schema:
type: object
properties:
nouns:
type: array
description: List of nouns.
adverbs:
type: array
description: List of adverbs.
verbs:
type: array
description: List of verbs.
number:
type: array
description: 'List of any numbers (e.g. three, 11) in the text.'
adjectives:
type: array
description: List of adjectives.
'405':
description: Invalid data type
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment