mirror of https://github.com/gsi-upm/senpy
Compare commits
No commits in common. '45421f4613f0c7a450bd1c42b5e78a417277aa78' and '8a516d927e1621eb3e6c11e36a6f45395d65e80e' have entirely different histories.
45421f4613
...
8a516d927e
File diff suppressed because it is too large
Load Diff
@ -1,152 +0,0 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Senpy in 1 minute\n",
|
||||
"\n",
|
||||
"This mini-tutorial only shows how to annotate with a service.\n",
|
||||
"We will use the [demo server](http://senpy.gsi.upm.es), which runs some open source plugins for sentiment and emotion analysis."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Annotating with senpy is as simple as issuing an HTTP request to the API using your favourite tool.\n",
|
||||
"This is just an example using curl:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 16,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"{\r\n",
|
||||
" \"@context\": \"http://senpy.gsi.upm.es/api/contexts/YXBpL3NlbnRpbWVudDE0MD8j\",\r\n",
|
||||
" \"@type\": \"Results\",\r\n",
|
||||
" \"entries\": [\r\n",
|
||||
" {\r\n",
|
||||
" \"@id\": \"prefix:\",\r\n",
|
||||
" \"@type\": \"Entry\",\r\n",
|
||||
" \"marl:hasOpinion\": [\r\n",
|
||||
" {\r\n",
|
||||
" \"@type\": \"Sentiment\",\r\n",
|
||||
" \"marl:hasPolarity\": \"marl:Positive\",\r\n",
|
||||
" \"prov:wasGeneratedBy\": \"prefix:Analysis_1554389334.6431913\"\r\n",
|
||||
" }\r\n",
|
||||
" ],\r\n",
|
||||
" \"nif:isString\": \"Senpy is awesome\",\r\n",
|
||||
" \"onyx:hasEmotionSet\": []\r\n",
|
||||
" }\r\n",
|
||||
" ]\r\n",
|
||||
"}"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"!curl \"http://senpy.gsi.upm.es/api/sentiment140\" --data-urlencode \"input=Senpy is awesome\""
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"**Congratulations**, you've used your first senpy service!"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Here is the equivalent using the `requests` library:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 17,
|
||||
"metadata": {
|
||||
"scrolled": true
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"{\n",
|
||||
" \"@context\": \"http://senpy.gsi.upm.es/api/contexts/YXBpL3NlbnRpbWVudDE0MD9pbnB1dD1TZW5weStpcythd2Vzb21lIw%3D%3D\",\n",
|
||||
" \"@type\": \"Results\",\n",
|
||||
" \"entries\": [\n",
|
||||
" {\n",
|
||||
" \"@id\": \"prefix:\",\n",
|
||||
" \"@type\": \"Entry\",\n",
|
||||
" \"marl:hasOpinion\": [\n",
|
||||
" {\n",
|
||||
" \"@type\": \"Sentiment\",\n",
|
||||
" \"marl:hasPolarity\": \"marl:Positive\",\n",
|
||||
" \"prov:wasGeneratedBy\": \"prefix:Analysis_1554389335.9803226\"\n",
|
||||
" }\n",
|
||||
" ],\n",
|
||||
" \"nif:isString\": \"Senpy is awesome\",\n",
|
||||
" \"onyx:hasEmotionSet\": []\n",
|
||||
" }\n",
|
||||
" ]\n",
|
||||
"}\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import requests\n",
|
||||
"res = requests.get('http://senpy.gsi.upm.es/api/sentiment140',\n",
|
||||
" params={\"input\": \"Senpy is awesome\",})\n",
|
||||
"print(res.text)"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"anaconda-cloud": {},
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.7.3"
|
||||
},
|
||||
"toc": {
|
||||
"colors": {
|
||||
"hover_highlight": "#DAA520",
|
||||
"running_highlight": "#FF0000",
|
||||
"selected_highlight": "#FFD700"
|
||||
},
|
||||
"moveMenuLeft": true,
|
||||
"nav_menu": {
|
||||
"height": "68px",
|
||||
"width": "252px"
|
||||
},
|
||||
"navigate_menu": true,
|
||||
"number_sections": true,
|
||||
"sideBar": true,
|
||||
"threshold": 4,
|
||||
"toc_cell": false,
|
||||
"toc_section_display": "block",
|
||||
"toc_window_display": false
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 1
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Before Width: | Height: | Size: 68 KiB |
@ -1,3 +1,2 @@
|
||||
sphinxcontrib-httpdomain>=1.4
|
||||
ipykernel
|
||||
nbsphinx
|
||||
|
Loading…
Reference in New Issue