Skip to content

Commit f0717a5

Browse files
author
Chris Park
committed
Reverting the script commit/merge which erased everything
1 parent f462636 commit f0717a5

File tree

443 files changed

+173901
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

443 files changed

+173901
-0
lines changed

.gitignore

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# General
2+
*~
3+
.DS_Store
4+
.DS_Store?
5+
.Spotlight-V100
6+
.Trashes
7+
ehthumbs.db
8+
Thumbs.db
9+
10+
# Jetbrains
11+
**/.idea/*
12+
!**/.idea/runConfigurations/
13+
*.iml
14+
target/
15+
16+
# Byte-compiled / optimized / DLL files
17+
__pycache__/
18+
*.py[cod]
19+
*$py.class
20+
21+
# C extensions
22+
*.so
23+
24+
# Distribution / packaging
25+
.Python
26+
env/
27+
build/
28+
develop-eggs/
29+
dist/
30+
downloads/
31+
eggs/
32+
.eggs/
33+
lib/
34+
lib64/
35+
parts/
36+
sdist/
37+
var/
38+
*.egg-info/
39+
.installed.cfg
40+
*.egg
41+
42+
# PyInstaller
43+
# Usually these files are written by a python script from a template
44+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
45+
*.manifest
46+
*.spec
47+
48+
# Installer logs
49+
pip-log.txt
50+
pip-delete-this-directory.txt
51+
52+
# Unit test / coverage reports
53+
htmlcov/
54+
.tox/
55+
.coverage
56+
.coverage.*
57+
.cache
58+
nosetests.xml
59+
coverage.xml
60+
*,cover
61+
62+
# Translations
63+
*.mo
64+
*.pot
65+
66+
# Django stuff:
67+
*.log
68+
69+
# Sphinx documentation
70+
docs/_build/
71+
72+
# PyBuilder
73+
target/

CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
0.5.1: first published version.
2+
0.5.2: refactored code and tests.
3+
0.5.3: change github repo for beta

LICENSE.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright (c) 2014-2015 Basis Technology Corporation.
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.

MANIFEST.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
include README.txt CHANGES.txt LICENSE.txt
2+
exclude MANIFEST.in

README.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# This is the Python client binding for Rosette API.
2+
3+
The Python binding requires Python 2.6 or greater and is available through pip:
4+
5+
`pip install rosette_api`
6+
7+
```python
8+
# 1. Set utf-8 encoding.
9+
# -*- coding: utf-8 -*-
10+
11+
# 2. Imports from rosette.api.
12+
from rosette.api import API, DocumentParameters, MorphologyOutput
13+
14+
# 3. Create API object.
15+
api = API("[your_api-key]")
16+
17+
# 4. Create parameters object
18+
params = DocumentParameters()
19+
20+
# 5. Set parameters.
21+
params["content"] = u"Was ist so böse an der Europäischen Zentralbank?"
22+
23+
# 6. Make a call.
24+
result = api.morphology(params)
25+
26+
# result is a Python dictionary that contains
27+
28+
{u'lemmas': [{u'text': u'Was', u'lemma': u'was'}, {u'text': u'ist', u'lemma': u'sein'}, {u'text': u'so', u'lemma': u'so'}, {u'text': u'böse', u'lemma': u'böse'}, {u'text': u'an', u'lemma': u'an'}, {u'text': u'der', u'lemma': u'der'}, {u'text': u'Europäischen', u'lemma': u'europäisch'}, {u'text': u'Zentralbank', u'lemma': u'Zentralbank'}, {u'text': u'?', u'lemma': u'?'}]}
29+
```
30+
31+
The samples use the following procedure:
32+
33+
1. If the application reads text in, set encoding to utf-8 in the first line of the script.
34+
35+
2. Import the `rosette.api` packages that your application needs. The `rosette.api` packages include
36+
* `API`
37+
* `DocumentParameters`
38+
* `NameMatchingParameters`
39+
* `NameTranslationParameters`
40+
* `MorphologyOutput`
41+
* `DataFormat`
42+
* `InputUnit`
43+
44+
3. Create an `API` object with the `user_key` parameter.
45+
46+
4. Create a parameters object for your request input:
47+
48+
| Parameter | Endpoint |
49+
| ----|----|
50+
| `NameMatchingParameters` | for `/matched-name` |
51+
| `NameTranslationParameters` | for `/translated-name` |
52+
| `DocumentParameters` | for all other endpoints |
53+
54+
55+
5. Set the parameters required for your operation: "`content`" or "`contentUri`" for `DocumentParameters`;
56+
"`name`" and "`targetLanguage`" for `NameTranslationParameters`; "`name1.text`" and "`name2.text`" for
57+
`NameMatchingParameters`; Other parameters are optional.
58+
59+
6. Create an `API` method for the endpoint you are calling. The methods are
60+
* `entities(linked)` where `linked` is `False` for entity extraction and `True` for entity linking.
61+
* `categories()`
62+
* `sentiment()`
63+
* `language()`
64+
* `morphology(tag)` where tag is a member of `MorphologyOutput`: `LEMMAS`, `PARTS_OF_SPEECH`, `COMPOUND_COMPONENTS`, `HAN_READINGS`, or `COMPLETE`. An empty tag is equivalent to `COMPLETE`.
65+
* `sentences()`
66+
* `tokens()`
67+
* `matched_name()`
68+
* `translated_name()`
69+
70+
7. The API will return a dictionary with the results.

0 commit comments

Comments
 (0)