mirror of
https://github.com/wassname/IndicoIo-python.git
synced 2026-09-10 11:40:41 +08:00
Batch support bug fixes
This commit is contained in:
-24
@@ -1,24 +0,0 @@
|
|||||||
language: python
|
|
||||||
python:
|
|
||||||
- 2.7
|
|
||||||
|
|
||||||
# Setup anaconda
|
|
||||||
before_install:
|
|
||||||
- wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh
|
|
||||||
- chmod +x miniconda.sh
|
|
||||||
- ./miniconda.sh -b
|
|
||||||
- export PATH=/home/travis/miniconda/bin:$PATH
|
|
||||||
- conda update --yes conda
|
|
||||||
# The next couple lines fix a crash with multiprocessing on Travis and are not specific to using Miniconda
|
|
||||||
- sudo rm -rf /dev/shm
|
|
||||||
- sudo ln -s /run/shm /dev/shm
|
|
||||||
|
|
||||||
# Install packages
|
|
||||||
install:
|
|
||||||
- conda install --yes python=$TRAVIS_PYTHON_VERSION atlas numpy scipy matplotlib nose dateutil pandas statsmodels requests requests six scikit-image
|
|
||||||
- python setup.py install
|
|
||||||
|
|
||||||
# Run test
|
|
||||||
script:
|
|
||||||
- nosetests -w ./tests/remote
|
|
||||||
|
|
||||||
+2
-1
@@ -13,4 +13,5 @@ v0.4.4, Thu Sep 25 -- Added dependencies installation to setup.py
|
|||||||
v0.4.5, Thu Sep 25 -- Added interface to local indico server
|
v0.4.5, Thu Sep 25 -- Added interface to local indico server
|
||||||
v0.4.6, Fri Oct 27 -- Updated to point to new indico api servers, cleaner REST API
|
v0.4.6, Fri Oct 27 -- Updated to point to new indico api servers, cleaner REST API
|
||||||
v0.4.8, Fri Nov 7 -- Updated API interface to include new text tags API
|
v0.4.8, Fri Nov 7 -- Updated API interface to include new text tags API
|
||||||
v0.4.11, Wed Dec 18 -- Updated tests for text tags
|
v0.4.11, Wed Dec 18 -- Updated tests for text tags
|
||||||
|
v0.4.12, Thu Dec 19 -- Added batch support interface
|
||||||
@@ -78,6 +78,14 @@ If you have a local indico server running, simply import from `indicoio.local`.
|
|||||||
>>> from indicoio.local import political, sentiment, fer, facial_features, language
|
>>> from indicoio.local import political, sentiment, fer, facial_features, language
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If you'd like to use our batch api interface, please send an email to contact@indico.io.
|
||||||
|
|
||||||
|
```
|
||||||
|
>>> from indicio import batch_sentiment
|
||||||
|
batch_sentiment(['Text to analyze', 'More text'], auth=("example@example.com", "********"))
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
------------
|
------------
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import indicoio.config as config
|
|||||||
|
|
||||||
JSON_HEADERS = {'Content-type': 'application/json', 'Accept': 'text/plain'}
|
JSON_HEADERS = {'Content-type': 'application/json', 'Accept': 'text/plain'}
|
||||||
|
|
||||||
Version, version, __version__, VERSION = ('0.4.11',) * 4
|
Version, version, __version__, VERSION = ('0.4.12',) * 4
|
||||||
|
|
||||||
from indicoio.text.sentiment import political, posneg
|
from indicoio.text.sentiment import political, posneg
|
||||||
from indicoio.text.sentiment import posneg as sentiment
|
from indicoio.text.sentiment import posneg as sentiment
|
||||||
|
|||||||
@@ -24,7 +24,8 @@ def api_handler(arg, url, batch=False, auth=None):
|
|||||||
data_dict = json.dumps({'data': arg})
|
data_dict = json.dumps({'data': arg})
|
||||||
if batch:
|
if batch:
|
||||||
url += "/batch"
|
url += "/batch"
|
||||||
auth = auth_query()
|
if not auth:
|
||||||
|
auth = auth_query()
|
||||||
response = requests.post(url, data=data_dict, headers=JSON_HEADERS, auth=auth).json()
|
response = requests.post(url, data=data_dict, headers=JSON_HEADERS, auth=auth).json()
|
||||||
results = response.get('results', False)
|
results = response.get('results', False)
|
||||||
if not results:
|
if not results:
|
||||||
|
|||||||
Reference in New Issue
Block a user