From 7e0ba1154167d1b31f09a2f96c4f82db05396f8e Mon Sep 17 00:00:00 2001 From: Janez K Date: Sat, 20 Dec 2014 15:12:24 +0100 Subject: [PATCH] work on active sentiment widgets --- workflows/streaming/db/package_data.json | 372 +++++++++++------------ workflows/streaming/library.py | 37 +++ 2 files changed, 223 insertions(+), 186 deletions(-) diff --git a/workflows/streaming/db/package_data.json b/workflows/streaming/db/package_data.json index 3f3edc0..b68e85a 100644 --- a/workflows/streaming/db/package_data.json +++ b/workflows/streaming/db/package_data.json @@ -1,6 +1,6 @@ [ { - "pk": 43, + "pk": 20, "model": "workflows.category", "fields": { "uid": "ca549cd5-2041-46f1-b175-a743b71b0e9b", @@ -12,11 +12,12 @@ } }, { - "pk": 222, + "pk": 114, "model": "workflows.abstractwidget", "fields": { - "category": 43, + "category": 20, "treeview_image": "", + "windows_queue": false, "name": "Active Learning Tweet Sentiment Analysis", "is_streaming": true, "uid": "eca4b45d-b484-4147-9a48-ddf07efda3cd", @@ -25,7 +26,6 @@ "package": "streaming", "static_image": "sentiment.png", "post_interact_action": "", - "windows_queue": false, "user": null, "visualization_view": "", "streaming_visualization_view": "streaming_active_annotation", @@ -39,10 +39,10 @@ } }, { - "pk": 490, + "pk": 216, "model": "workflows.abstractinput", "fields": { - "widget": 222, + "widget": 114, "name": "List of Tweets", "short_name": "ltw", "uid": "b3d2dddb-c99f-4c04-9b0f-53199cf17c50", @@ -57,10 +57,10 @@ } }, { - "pk": 233, + "pk": 129, "model": "workflows.abstractoutput", "fields": { - "widget": 222, + "widget": 114, "name": "Sentiment Annotated List Of Tweets", "short_name": "ltw", "variable": "ltw", @@ -70,11 +70,12 @@ } }, { - "pk": 395, + "pk": 115, "model": "workflows.abstractwidget", "fields": { - "category": 43, + "category": 20, "treeview_image": "", + "windows_queue": false, "name": "Active Learning Tweet Sentiment Analysis v2", "is_streaming": true, "uid": "ce256688-9b48-41cb-b3b1-8e72176e021a", @@ -83,7 +84,6 @@ "package": "streaming", "static_image": "sentiment.png", "post_interact_action": "", - "windows_queue": false, "user": null, "visualization_view": "", "streaming_visualization_view": "streaming_active_annotation", @@ -97,10 +97,10 @@ } }, { - "pk": 928, + "pk": 217, "model": "workflows.abstractinput", "fields": { - "widget": 395, + "widget": 115, "name": "List of Tweets", "short_name": "ltw", "uid": "a5ace904-6fd6-4023-bfd5-d4b81afd6369", @@ -115,10 +115,10 @@ } }, { - "pk": 929, + "pk": 218, "model": "workflows.abstractinput", "fields": { - "widget": 395, + "widget": 115, "name": "Batch size", "short_name": "b", "uid": "c36187d3-5df0-4f06-85b0-d01ea921f7b3", @@ -133,10 +133,10 @@ } }, { - "pk": 930, + "pk": 219, "model": "workflows.abstractinput", "fields": { - "widget": 395, + "widget": 115, "name": "Number of tweets for hand-labeling chosen with the \"Closest to the neutral zone\" query strategy.", "short_name": "q1", "uid": "0b684a5d-528e-41c4-adb7-59a09bc1a39b", @@ -151,10 +151,10 @@ } }, { - "pk": 931, + "pk": 220, "model": "workflows.abstractinput", "fields": { - "widget": 395, + "widget": 115, "name": "Number of tweets for hand-labeling chosen with the random query strategy.", "short_name": "q2", "uid": "216ae867-a808-47f4-a233-052d62f09dd8", @@ -169,10 +169,10 @@ } }, { - "pk": 416, + "pk": 130, "model": "workflows.abstractoutput", "fields": { - "widget": 395, + "widget": 115, "name": "Sentiment Annotated List Of Tweets", "short_name": "ltw", "variable": "ltw", @@ -182,11 +182,12 @@ } }, { - "pk": 223, + "pk": 116, "model": "workflows.abstractwidget", "fields": { - "category": 43, + "category": 20, "treeview_image": "", + "windows_queue": false, "name": "Add neutral zone", "is_streaming": false, "uid": "722e5c1f-9d52-4fa1-81f4-afde8ea508d8", @@ -195,7 +196,6 @@ "package": "streaming", "static_image": "neutral_zone.png", "post_interact_action": "", - "windows_queue": false, "user": null, "visualization_view": "", "streaming_visualization_view": "", @@ -209,10 +209,10 @@ } }, { - "pk": 491, + "pk": 221, "model": "workflows.abstractinput", "fields": { - "widget": 223, + "widget": 116, "name": "List of Tweets", "short_name": "ltw", "uid": "f3027af6-ee71-4991-9ae7-b8877de16b35", @@ -227,10 +227,10 @@ } }, { - "pk": 492, + "pk": 222, "model": "workflows.abstractinput", "fields": { - "widget": 223, + "widget": 116, "name": "Neutral zone", "short_name": "nz", "uid": "607375c0-f4e3-43b8-9f99-2830ac7e5c83", @@ -245,10 +245,10 @@ } }, { - "pk": 234, + "pk": 131, "model": "workflows.abstractoutput", "fields": { - "widget": 223, + "widget": 116, "name": "List of Tweets", "short_name": "ltw", "variable": "ltw", @@ -258,11 +258,12 @@ } }, { - "pk": 224, + "pk": 117, "model": "workflows.abstractwidget", "fields": { - "category": 43, + "category": 20, "treeview_image": "", + "windows_queue": false, "name": "Filter tweets by language", "is_streaming": false, "uid": "63608f38-ee19-4898-90ba-ea2a928daa1f", @@ -271,7 +272,6 @@ "package": "streaming", "static_image": "filter_tweets.png", "post_interact_action": "", - "windows_queue": false, "user": null, "visualization_view": "", "streaming_visualization_view": "", @@ -285,10 +285,10 @@ } }, { - "pk": 493, + "pk": 223, "model": "workflows.abstractinput", "fields": { - "widget": 224, + "widget": 117, "name": "List of Tweets", "short_name": "ltw", "uid": "e969d30e-dc5c-4c45-8fa4-319e83f20699", @@ -303,10 +303,10 @@ } }, { - "pk": 494, + "pk": 224, "model": "workflows.abstractinput", "fields": { - "widget": 224, + "widget": 117, "name": "Language", "short_name": "lan", "uid": "9befb8ed-7644-4f41-8887-1c6f74bdeba7", @@ -321,10 +321,10 @@ } }, { - "pk": 235, + "pk": 132, "model": "workflows.abstractoutput", "fields": { - "widget": 224, + "widget": 117, "name": "List of Tweets", "short_name": "ltw", "variable": "ltw", @@ -334,11 +334,12 @@ } }, { - "pk": 243, + "pk": 118, "model": "workflows.abstractwidget", "fields": { - "category": 43, + "category": 20, "treeview_image": "", + "windows_queue": false, "name": "Get news article", "is_streaming": true, "uid": "96cc52ff-109a-48b3-ac54-e0a8e3d4f1fa", @@ -347,7 +348,6 @@ "package": "streaming", "static_image": "", "post_interact_action": "", - "windows_queue": false, "user": null, "visualization_view": "", "streaming_visualization_view": "", @@ -361,10 +361,10 @@ } }, { - "pk": 522, + "pk": 225, "model": "workflows.abstractinput", "fields": { - "widget": 243, + "widget": 118, "name": "URL", "short_name": "url", "uid": "9cf13cf8-deb9-4175-8a71-d11da0984c99", @@ -379,10 +379,10 @@ } }, { - "pk": 251, + "pk": 133, "model": "workflows.abstractoutput", "fields": { - "widget": 243, + "widget": 118, "name": "Text", "short_name": "txt", "variable": "text", @@ -392,11 +392,12 @@ } }, { - "pk": 242, + "pk": 119, "model": "workflows.abstractwidget", "fields": { - "category": 43, + "category": 20, "treeview_image": "", + "windows_queue": false, "name": "Porter stemmer on triplets", "is_streaming": true, "uid": "9dc49613-daa0-440f-bb2c-80909edee633", @@ -405,7 +406,6 @@ "package": "streaming", "static_image": "", "post_interact_action": "", - "windows_queue": false, "user": null, "visualization_view": "", "streaming_visualization_view": "", @@ -419,10 +419,10 @@ } }, { - "pk": 521, + "pk": 226, "model": "workflows.abstractinput", "fields": { - "widget": 242, + "widget": 119, "name": "Triplets", "short_name": "tri", "uid": "4887ef25-3d11-47a7-97b3-6d225eddb38a", @@ -437,10 +437,10 @@ } }, { - "pk": 250, + "pk": 134, "model": "workflows.abstractoutput", "fields": { - "widget": 242, + "widget": 119, "name": "Triplets", "short_name": "tri", "variable": "triplets", @@ -450,11 +450,12 @@ } }, { - "pk": 225, + "pk": 120, "model": "workflows.abstractwidget", "fields": { - "category": 43, + "category": 20, "treeview_image": "", + "windows_queue": false, "name": "RSS Reader", "is_streaming": true, "uid": "723e4654-abf4-4c9f-920f-08915c4d7a72", @@ -463,7 +464,6 @@ "package": "streaming", "static_image": "rss.png", "post_interact_action": "", - "windows_queue": false, "user": null, "visualization_view": "", "streaming_visualization_view": "", @@ -477,10 +477,10 @@ } }, { - "pk": 495, + "pk": 227, "model": "workflows.abstractinput", "fields": { - "widget": 225, + "widget": 120, "name": "RSS URL", "short_name": "url", "uid": "bab53d85-8423-409c-91c3-f36a857b5e5f", @@ -495,10 +495,10 @@ } }, { - "pk": 236, + "pk": 135, "model": "workflows.abstractoutput", "fields": { - "widget": 225, + "widget": 120, "name": "URL", "short_name": "url", "variable": "url", @@ -508,11 +508,12 @@ } }, { - "pk": 226, + "pk": 121, "model": "workflows.abstractwidget", "fields": { - "category": 43, + "category": 20, "treeview_image": "", + "windows_queue": false, "name": "Remove words from tweets", "is_streaming": false, "uid": "258e97c6-e44d-41a3-97c0-689de94f3049", @@ -521,7 +522,6 @@ "package": "streaming", "static_image": "", "post_interact_action": "", - "windows_queue": false, "user": null, "visualization_view": "", "streaming_visualization_view": "", @@ -535,10 +535,10 @@ } }, { - "pk": 496, + "pk": 228, "model": "workflows.abstractinput", "fields": { - "widget": 226, + "widget": 121, "name": "List of Tweets", "short_name": "ltw", "uid": "68692ac4-df32-432d-8b10-00ed68ec7c04", @@ -553,10 +553,10 @@ } }, { - "pk": 497, + "pk": 229, "model": "workflows.abstractinput", "fields": { - "widget": 226, + "widget": 121, "name": "Words", "short_name": "wrd", "uid": "69b06741-8055-4dad-b677-3940d3434bc2", @@ -571,10 +571,10 @@ } }, { - "pk": 237, + "pk": 136, "model": "workflows.abstractoutput", "fields": { - "widget": 226, + "widget": 121, "name": "List of Tweets", "short_name": "ltw", "variable": "ltw", @@ -584,11 +584,12 @@ } }, { - "pk": 227, + "pk": 122, "model": "workflows.abstractwidget", "fields": { - "category": 43, + "category": 20, "treeview_image": "", + "windows_queue": false, "name": "Simulate stream from Gamasystem csv", "is_streaming": true, "uid": "7a72dcc4-53a2-4a45-96e6-31b0c2e01e32", @@ -597,7 +598,6 @@ "package": "streaming", "static_image": "twitter.png", "post_interact_action": "", - "windows_queue": false, "user": null, "visualization_view": "", "streaming_visualization_view": "", @@ -611,10 +611,10 @@ } }, { - "pk": 498, + "pk": 230, "model": "workflows.abstractinput", "fields": { - "widget": 227, + "widget": 122, "name": "CSV file", "short_name": "csv", "uid": "e064e54e-47de-42a1-a9a5-fa1552845403", @@ -629,10 +629,10 @@ } }, { - "pk": 238, + "pk": 137, "model": "workflows.abstractoutput", "fields": { - "widget": 227, + "widget": 122, "name": "List of tweets", "short_name": "ltw", "variable": "ltw", @@ -642,11 +642,12 @@ } }, { - "pk": 228, + "pk": 123, "model": "workflows.abstractwidget", "fields": { - "category": 43, + "category": 20, "treeview_image": "", + "windows_queue": false, "name": "Simulate stream from text file", "is_streaming": true, "uid": "9a20da2e-0903-4332-8938-63b15d370657", @@ -655,7 +656,6 @@ "package": "streaming", "static_image": "twitter.png", "post_interact_action": "", - "windows_queue": false, "user": null, "visualization_view": "", "streaming_visualization_view": "", @@ -669,10 +669,10 @@ } }, { - "pk": 499, + "pk": 231, "model": "workflows.abstractinput", "fields": { - "widget": 228, + "widget": 123, "name": "Text file", "short_name": "txt", "uid": "b3f3126c-6004-41f4-839b-08e047ffcb62", @@ -687,10 +687,10 @@ } }, { - "pk": 239, + "pk": 138, "model": "workflows.abstractoutput", "fields": { - "widget": 228, + "widget": 123, "name": "List of tweets", "short_name": "ltw", "variable": "ltw", @@ -700,11 +700,12 @@ } }, { - "pk": 229, + "pk": 124, "model": "workflows.abstractwidget", "fields": { - "category": 43, + "category": 20, "treeview_image": "", + "windows_queue": false, "name": "Sliding Window", "is_streaming": true, "uid": "b21b4e13-8d15-4584-ad17-03405a79b020", @@ -713,7 +714,6 @@ "package": "streaming", "static_image": "sliding-window.png", "post_interact_action": "", - "windows_queue": false, "user": null, "visualization_view": "", "streaming_visualization_view": "", @@ -727,10 +727,10 @@ } }, { - "pk": 500, + "pk": 232, "model": "workflows.abstractinput", "fields": { - "widget": 229, + "widget": 124, "name": "List", "short_name": "lst", "uid": "5411d874-0e24-446e-88b2-065c23ee2817", @@ -745,10 +745,10 @@ } }, { - "pk": 501, + "pk": 233, "model": "workflows.abstractinput", "fields": { - "widget": 229, + "widget": 124, "name": "Size", "short_name": "siz", "uid": "fb2215c6-04e6-4c0b-97e5-f380c4b2f6e8", @@ -763,10 +763,10 @@ } }, { - "pk": 240, + "pk": 139, "model": "workflows.abstractoutput", "fields": { - "widget": 229, + "widget": 124, "name": "List", "short_name": "lst", "variable": "list", @@ -776,11 +776,12 @@ } }, { - "pk": 230, + "pk": 125, "model": "workflows.abstractwidget", "fields": { - "category": 43, + "category": 20, "treeview_image": "", + "windows_queue": false, "name": "Split positive and negative tweets", "is_streaming": false, "uid": "2786eaa2-3505-4d44-9962-23df9f23c072", @@ -789,7 +790,6 @@ "package": "streaming", "static_image": "split.png", "post_interact_action": "", - "windows_queue": false, "user": null, "visualization_view": "", "streaming_visualization_view": "", @@ -803,10 +803,10 @@ } }, { - "pk": 502, + "pk": 234, "model": "workflows.abstractinput", "fields": { - "widget": 230, + "widget": 125, "name": "List of Tweets", "short_name": "ltw", "uid": "eea9cd8a-dbbb-4c08-98c4-d0d6df97aee0", @@ -821,10 +821,10 @@ } }, { - "pk": 241, + "pk": 140, "model": "workflows.abstractoutput", "fields": { - "widget": 230, + "widget": 125, "name": "Positive tweets", "short_name": "ptw", "variable": "ptw", @@ -834,10 +834,10 @@ } }, { - "pk": 242, + "pk": 141, "model": "workflows.abstractoutput", "fields": { - "widget": 230, + "widget": 125, "name": "Negative tweets", "short_name": "ntw", "variable": "ntw", @@ -847,11 +847,12 @@ } }, { - "pk": 240, + "pk": 126, "model": "workflows.abstractwidget", "fields": { - "category": 43, + "category": 20, "treeview_image": "", + "windows_queue": false, "name": "Summarize news article", "is_streaming": true, "uid": "90c0715f-36e0-4e06-a2ef-7fb88bf95943", @@ -860,7 +861,6 @@ "package": "streaming", "static_image": "summary.png", "post_interact_action": "", - "windows_queue": false, "user": null, "visualization_view": "", "streaming_visualization_view": "", @@ -874,10 +874,10 @@ } }, { - "pk": 519, + "pk": 235, "model": "workflows.abstractinput", "fields": { - "widget": 240, + "widget": 126, "name": "URL", "short_name": "url", "uid": "e475bee2-b965-48fe-b027-4447bc0c6005", @@ -892,10 +892,10 @@ } }, { - "pk": 249, + "pk": 142, "model": "workflows.abstractoutput", "fields": { - "widget": 240, + "widget": 126, "name": "Summary", "short_name": "txt", "variable": "summary", @@ -905,11 +905,12 @@ } }, { - "pk": 231, + "pk": 127, "model": "workflows.abstractwidget", "fields": { - "category": 43, + "category": 20, "treeview_image": "", + "windows_queue": false, "name": "Text Sentiment Analysis", "is_streaming": true, "uid": "f54ed3e2-280e-48cf-b1f3-7e8fcfa2b94a", @@ -918,7 +919,6 @@ "package": "streaming", "static_image": "sentiment.png", "post_interact_action": "", - "windows_queue": false, "user": null, "visualization_view": "", "streaming_visualization_view": "", @@ -932,10 +932,10 @@ } }, { - "pk": 503, + "pk": 236, "model": "workflows.abstractinput", "fields": { - "widget": 231, + "widget": 127, "name": "Text", "short_name": "tex", "uid": "f9236516-4a3b-4441-af21-86930bbd958a", @@ -950,10 +950,10 @@ } }, { - "pk": 504, + "pk": 237, "model": "workflows.abstractinput", "fields": { - "widget": 231, + "widget": 127, "name": "Language", "short_name": "lng", "uid": "456adb59-6533-4d24-98c2-be076c43c1fb", @@ -968,10 +968,10 @@ } }, { - "pk": 243, + "pk": 143, "model": "workflows.abstractoutput", "fields": { - "widget": 231, + "widget": 127, "name": "Sentiment", "short_name": "sen", "variable": "sentiment", @@ -981,10 +981,10 @@ } }, { - "pk": 244, + "pk": 144, "model": "workflows.abstractoutput", "fields": { - "widget": 231, + "widget": 127, "name": "Reliability", "short_name": "rel", "variable": "reliability", @@ -994,11 +994,12 @@ } }, { - "pk": 239, + "pk": 128, "model": "workflows.abstractwidget", "fields": { - "category": 43, + "category": 20, "treeview_image": "", + "windows_queue": false, "name": "Triplet Extraction", "is_streaming": true, "uid": "e6ea9179-7d50-4452-b6de-6c71d77213ef", @@ -1007,7 +1008,6 @@ "package": "streaming", "static_image": "triplets.png", "post_interact_action": "", - "windows_queue": false, "user": null, "visualization_view": "", "streaming_visualization_view": "", @@ -1021,10 +1021,10 @@ } }, { - "pk": 518, + "pk": 238, "model": "workflows.abstractinput", "fields": { - "widget": 239, + "widget": 128, "name": "Text", "short_name": "str", "uid": "512c2f51-ba58-4382-9ee3-6fec78bee74b", @@ -1039,10 +1039,10 @@ } }, { - "pk": 248, + "pk": 145, "model": "workflows.abstractoutput", "fields": { - "widget": 239, + "widget": 128, "name": "Triplets", "short_name": "tri", "variable": "triplets", @@ -1052,11 +1052,12 @@ } }, { - "pk": 232, + "pk": 129, "model": "workflows.abstractwidget", "fields": { - "category": 43, + "category": 20, "treeview_image": "", + "windows_queue": false, "name": "Tweet Sentiment Analysis", "is_streaming": true, "uid": "62e7f354-d6c7-4c4c-b1b7-795ac613a7e0", @@ -1065,7 +1066,6 @@ "package": "streaming", "static_image": "sentiment.png", "post_interact_action": "", - "windows_queue": false, "user": null, "visualization_view": "", "streaming_visualization_view": "", @@ -1079,10 +1079,10 @@ } }, { - "pk": 505, + "pk": 239, "model": "workflows.abstractinput", "fields": { - "widget": 232, + "widget": 129, "name": "List of Tweets", "short_name": "ltw", "uid": "bf47f1f1-d4e2-47f8-bbe3-fa28281763e0", @@ -1097,10 +1097,10 @@ } }, { - "pk": 245, + "pk": 146, "model": "workflows.abstractoutput", "fields": { - "widget": 232, + "widget": 129, "name": "Sentiment Annotated List Of Tweets", "short_name": "ltw", "variable": "ltw", @@ -1110,11 +1110,12 @@ } }, { - "pk": 233, + "pk": 130, "model": "workflows.abstractwidget", "fields": { - "category": 43, + "category": 20, "treeview_image": "", + "windows_queue": false, "name": "Twitter", "is_streaming": true, "uid": "3a929977-0708-4f92-8296-2e109ff0566a", @@ -1123,7 +1124,6 @@ "package": "streaming", "static_image": "twitter.png", "post_interact_action": "", - "windows_queue": false, "user": null, "visualization_view": "", "streaming_visualization_view": "", @@ -1137,10 +1137,10 @@ } }, { - "pk": 506, + "pk": 240, "model": "workflows.abstractinput", "fields": { - "widget": 233, + "widget": 130, "name": "Query", "short_name": "q", "uid": "07b8a51c-41d9-48af-b823-92e94ce300d2", @@ -1155,10 +1155,10 @@ } }, { - "pk": 507, + "pk": 241, "model": "workflows.abstractinput", "fields": { - "widget": 233, + "widget": 130, "name": "Geocode", "short_name": "geo", "uid": "80d1e542-7f7c-4a8e-b683-764d0a754b03", @@ -1173,10 +1173,10 @@ } }, { - "pk": 508, + "pk": 242, "model": "workflows.abstractinput", "fields": { - "widget": 233, + "widget": 130, "name": "Use ClowdFlows authentication (warning: not stable)", "short_name": "cfa", "uid": "c78c8f03-92c4-4f6c-972d-c064baecd09a", @@ -1191,10 +1191,10 @@ } }, { - "pk": 509, + "pk": 243, "model": "workflows.abstractinput", "fields": { - "widget": 233, + "widget": 130, "name": "Consumer Key", "short_name": "ck", "uid": "ed2db381-2ed2-4a4d-bd6d-9f9dc0430a50", @@ -1209,10 +1209,10 @@ } }, { - "pk": 510, + "pk": 244, "model": "workflows.abstractinput", "fields": { - "widget": 233, + "widget": 130, "name": "Consumer Secret", "short_name": "cs", "uid": "9b9d6268-675a-46c5-82d5-b143e5fdd326", @@ -1227,10 +1227,10 @@ } }, { - "pk": 511, + "pk": 245, "model": "workflows.abstractinput", "fields": { - "widget": 233, + "widget": 130, "name": "Access Token", "short_name": "at", "uid": "a951f2d1-c2d1-40b3-afe9-799195e03aa0", @@ -1245,10 +1245,10 @@ } }, { - "pk": 512, + "pk": 246, "model": "workflows.abstractinput", "fields": { - "widget": 233, + "widget": 130, "name": "Access Token Secret", "short_name": "as", "uid": "299ae040-2916-4b88-8a79-3ced689ef23f", @@ -1263,10 +1263,10 @@ } }, { - "pk": 246, + "pk": 147, "model": "workflows.abstractoutput", "fields": { - "widget": 233, + "widget": 130, "name": "List of tweets", "short_name": "ltw", "variable": "ltw", @@ -1276,11 +1276,12 @@ } }, { - "pk": 244, + "pk": 131, "model": "workflows.abstractwidget", "fields": { - "category": 43, + "category": 20, "treeview_image": "", + "windows_queue": false, "name": "WordNet lemmatizer on triplets", "is_streaming": true, "uid": "10957b62-2dcb-4461-8146-70eecf27fcff", @@ -1289,7 +1290,6 @@ "package": "streaming", "static_image": "wordnet.png", "post_interact_action": "", - "windows_queue": false, "user": null, "visualization_view": "", "streaming_visualization_view": "", @@ -1303,10 +1303,10 @@ } }, { - "pk": 523, + "pk": 247, "model": "workflows.abstractinput", "fields": { - "widget": 244, + "widget": 131, "name": "Triplets", "short_name": "tri", "uid": "e9bc6945-54fb-4128-87ae-75aa1b7f9a79", @@ -1321,10 +1321,10 @@ } }, { - "pk": 252, + "pk": 148, "model": "workflows.abstractoutput", "fields": { - "widget": 244, + "widget": 131, "name": "Triplets", "short_name": "tri", "variable": "triplets", @@ -1334,11 +1334,11 @@ } }, { - "pk": 44, + "pk": 21, "model": "workflows.category", "fields": { "uid": "d0803d58-35d4-4590-bb32-f2041e735247", - "parent": 43, + "parent": 20, "workflow": null, "user": null, "order": 1, @@ -1346,11 +1346,12 @@ } }, { - "pk": 234, + "pk": 132, "model": "workflows.abstractwidget", "fields": { - "category": 44, + "category": 21, "treeview_image": "", + "windows_queue": false, "name": "Collect and Display tweets", "is_streaming": true, "uid": "f950409e-5913-4937-b7e5-7d9677a88e19", @@ -1359,7 +1360,6 @@ "package": "streaming", "static_image": "display-tweets.png", "post_interact_action": "", - "windows_queue": false, "user": null, "visualization_view": "", "streaming_visualization_view": "streaming_collect_and_display_visualization", @@ -1373,10 +1373,10 @@ } }, { - "pk": 513, + "pk": 248, "model": "workflows.abstractinput", "fields": { - "widget": 234, + "widget": 132, "name": "List of Tweets", "short_name": "ltw", "uid": "8479d41b-43af-4db9-a144-d0a438400404", @@ -1391,11 +1391,12 @@ } }, { - "pk": 235, + "pk": 133, "model": "workflows.abstractwidget", "fields": { - "category": 44, + "category": 21, "treeview_image": "", + "windows_queue": false, "name": "Display tweets", "is_streaming": true, "uid": "95027c9a-b555-4b47-9f9a-57cc4e40fb96", @@ -1404,7 +1405,6 @@ "package": "streaming", "static_image": "display-tweets.png", "post_interact_action": "", - "windows_queue": false, "user": null, "visualization_view": "", "streaming_visualization_view": "streaming_display_tweets_visualization", @@ -1418,10 +1418,10 @@ } }, { - "pk": 514, + "pk": 249, "model": "workflows.abstractinput", "fields": { - "widget": 235, + "widget": 133, "name": "List of Tweets", "short_name": "ltw", "uid": "e8fc4c63-2e17-4ad4-a3ab-6ec8d554ecac", @@ -1436,11 +1436,12 @@ } }, { - "pk": 236, + "pk": 134, "model": "workflows.abstractwidget", "fields": { - "category": 44, + "category": 21, "treeview_image": "", + "windows_queue": false, "name": "Sentiment graph", "is_streaming": true, "uid": "c4dc0648-79b0-49e8-b670-aef1f511050d", @@ -1449,7 +1450,6 @@ "package": "streaming", "static_image": "graph.png", "post_interact_action": "", - "windows_queue": false, "user": null, "visualization_view": "", "streaming_visualization_view": "streaming_sentiment_graph", @@ -1463,10 +1463,10 @@ } }, { - "pk": 515, + "pk": 250, "model": "workflows.abstractinput", "fields": { - "widget": 236, + "widget": 134, "name": "List of Tweets", "short_name": "ltw", "uid": "0413b69e-b954-4a77-a8ad-59dc559ee4c6", @@ -1481,11 +1481,12 @@ } }, { - "pk": 245, + "pk": 135, "model": "workflows.abstractwidget", "fields": { - "category": 44, + "category": 21, "treeview_image": "", + "windows_queue": false, "name": "Streaming triplet graph", "is_streaming": true, "uid": "cf3f6218-1b21-4864-9ee1-c22069abe03d", @@ -1494,7 +1495,6 @@ "package": "streaming", "static_image": "BiomineVisualizer.png", "post_interact_action": "", - "windows_queue": false, "user": null, "visualization_view": "", "streaming_visualization_view": "streaming_triplet_graph_visualization", @@ -1508,10 +1508,10 @@ } }, { - "pk": 524, + "pk": 251, "model": "workflows.abstractinput", "fields": { - "widget": 245, + "widget": 135, "name": "Triplets", "short_name": "tri", "uid": "e9c4bd5a-0ea4-4739-bc7c-d95bb40d7e57", @@ -1526,11 +1526,12 @@ } }, { - "pk": 237, + "pk": 136, "model": "workflows.abstractwidget", "fields": { - "category": 44, + "category": 21, "treeview_image": "", + "windows_queue": false, "name": "Tweet word cloud", "is_streaming": true, "uid": "e83e17a4-6e8a-40de-8ebe-585503d065e5", @@ -1539,7 +1540,6 @@ "package": "streaming", "static_image": "word-cloud.png", "post_interact_action": "", - "windows_queue": false, "user": null, "visualization_view": "", "streaming_visualization_view": "streaming_tweet_cloud", @@ -1553,10 +1553,10 @@ } }, { - "pk": 516, + "pk": 252, "model": "workflows.abstractinput", "fields": { - "widget": 237, + "widget": 136, "name": "List of Tweets", "short_name": "ltw", "uid": "98c77b95-1221-4a85-bdbf-6436327e39b3", diff --git a/workflows/streaming/library.py b/workflows/streaming/library.py index 0b7b219..a0387e0 100644 --- a/workflows/streaming/library.py +++ b/workflows/streaming/library.py @@ -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 -- GitLab