Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
clowdflows
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Alain Shakour
clowdflows
Commits
7e0ba115
Commit
7e0ba115
authored
Dec 20, 2014
by
Janez K
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
work on active sentiment widgets
parent
3d9b41dd
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
223 additions
and
186 deletions
+223
-186
workflows/streaming/db/package_data.json
workflows/streaming/db/package_data.json
+186
-186
workflows/streaming/library.py
workflows/streaming/library.py
+37
-0
No files found.
workflows/streaming/db/package_data.json
View file @
7e0ba115
This diff is collapsed.
Click to expand it.
workflows/streaming/library.py
View file @
7e0ba115
...
...
@@ -379,6 +379,43 @@ def streaming_active_sentiment_analysis(input_dict,widget,stream=None):
return
output_dict
def
streaming_active_sentiment_analysis2
(
input_dict
,
widget
,
stream
=
None
):
import
pickle
from
pysimplesoap.client
import
SoapClient
,
SoapFault
import
pysimplesoap
client
=
SoapClient
(
location
=
"http://95.87.154.167:8098/"
,
action
=
'http://95.87.154.167:8098/'
,
namespace
=
"http://example.com/tweetsentiment.wsdl"
,
soap_ns
=
'soap'
,
trace
=
False
,
ns
=
False
)
pysimplesoap
.
client
.
TIMEOUT
=
600
list_of_tweets
=
input_dict
[
'ltw'
]
new_list_of_tweets
=
[]
for
tweet
in
list_of_tweets
:
new_list_of_tweets
.
append
(
tweet
[
'text'
])
workflow_id
=
widget
.
id
service_input
=
pickle
.
dumps
((
str
(
workflow_id
),
input_dict
[
'b_size'
],
input_dict
[
'q_strategy_closest'
],
input_dict
[
'q_strategy_random'
],
new_list_of_tweets
))
#print service_input
response
=
client
.
ActiveClassifyMultiple
(
workflowtweets
=
service_input
)
i
=
0
new_ltw
=
pickle
.
loads
(
str
(
response
.
ActiveClassifyMultipleResult
))
for
new_tweet
in
new_ltw
:
if
new_tweet
[
0
]
==
"True"
:
list_of_tweets
[
i
][
'sentiment'
]
=
"Positive"
elif
new_tweet
[
0
]
==
"False"
:
list_of_tweets
[
i
][
'sentiment'
]
=
"Negative"
list_of_tweets
[
i
][
'reliability'
]
=
new_tweet
[
1
]
i
=
i
+
1
output_dict
=
{}
output_dict
[
'ltw'
]
=
list_of_tweets
return
output_dict
def
streaming_sentiment_analysis
(
input_dict
,
widget
,
stream
=
None
):
import
pickle
from
pysimplesoap.client
import
SoapClient
,
SoapFault
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment