From bb46501b12755f4344743e2c2b79fa86dba448f8 Mon Sep 17 00:00:00 2001 From: leflocha Date: Sun, 28 Mar 2021 14:00:03 -0400 Subject: [PATCH 01/22] blank page --- Pipfile | 2 +- Pipfile.lock | 227 ++++++++++++++++++++++++++++++++++------------- streamlit_web.py | 10 +++ 3 files changed, 176 insertions(+), 63 deletions(-) diff --git a/Pipfile b/Pipfile index b0aa1717..2bd8f7ff 100644 --- a/Pipfile +++ b/Pipfile @@ -18,7 +18,7 @@ pytest = "*" requests = "*" commonmark = "*" codecov = "*" -streamlit = "*" +streamlit = "==0.78.0" altair = "*" textblob = "*" scipy = "*" diff --git a/Pipfile.lock b/Pipfile.lock index 813a690e..667b5e2b 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "c9126e8f69ae7b03d9e1cd82452f258090891c271d491ef0f416107c2cfb68eb" + "sha256": "058bd777b9bcfb29194098f8e6c62010a60980ff3623c34209b0668b762ecfee" }, "pipfile-spec": 6, "requires": {}, @@ -22,14 +22,6 @@ "index": "pypi", "version": "==4.1.0" }, - "appnope": { - "hashes": [ - "sha256:93aa393e9d6c54c5cd570ccadd8edad61ea0c4b9ea7a01409020c9aa019eb442", - "sha256:dd83cd4b5b460958838f6eb3000c660b1f9caf2a5b1de4264e941512f603258a" - ], - "markers": "sys_platform == 'darwin' and platform_system == 'Darwin'", - "version": "==0.1.2" - }, "argon2-cffi": { "hashes": [ "sha256:05a8ac07c7026542377e38389638a8a1e9b78f1cd8439cd7493b39f08dd75fbf", @@ -77,6 +69,14 @@ "markers": "python_version >= '3.5'", "version": "==1.10" }, + "atomicwrites": { + "hashes": [ + "sha256:6d1784dea7c0c8d4a5172b6c620f40b6e4cbfdf96d783691f2e1302a7b88e197", + "sha256:ae70396ad1a434f9c7046fd2dd196fc04b12f9e91ffb859164193be8b6168a7a" + ], + "markers": "sys_platform == 'win32'", + "version": "==1.4.0" + }, "attrs": { "hashes": [ "sha256:31b2eced602aa8423c2aea9c76a724617ed67cf9513173fd3a4f03e3a929c7e6", @@ -222,6 +222,14 @@ "index": "pypi", "version": "==2.1.11" }, + "colorama": { + "hashes": [ + "sha256:5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b", + "sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2" + ], + "markers": "sys_platform == 'win32' and sys_platform == 'win32' and sys_platform == 'win32'", + "version": "==0.4.4" + }, "commonmark": { "hashes": [ "sha256:452f9dc859be7f06631ddcb328b6919c67984aca654e5fefb3914d54691aed60", @@ -313,6 +321,44 @@ ], "version": "==2.0.5" }, + "cython": { + "hashes": [ + "sha256:03f6bbb380ad0acb744fb06e42996ea217e9d00016ca0ff6f2e7d60f580d0360", + "sha256:05e8cfd3a3a6087aec49a1ae08a89171db991956209406d1e5576f9db70ece52", + "sha256:05eb79efc8029d487251c8a2702a909a8ba33c332e06d2f3980866541bd81253", + "sha256:094d28a34c3fa992ae02aea1edbe6ff89b3cc5870b6ee38b5baeb805dc57b013", + "sha256:0c70e842e52e2f50cc43bad43b5e5bc515f30821a374e544abb0e0746f2350ff", + "sha256:1dcdaa319558eb924294a554dcf6c12383ec947acc7e779e8d3622409a7f7d28", + "sha256:1fc5bdda28f25fec44e4721677458aa509d743cd350862270309d61aa148d6ff", + "sha256:280573a01d9348d44a42d6a9c651d9f7eb1fe9217df72555b2a118f902996a10", + "sha256:298ceca7b0f0da4205fcb0b7c9ac9e120e2dafffd5019ba1618e84ef89434b5a", + "sha256:4074a8bff0040035673cc6dd365a762476d6bff4d03d8ce6904e3e53f9a25dc8", + "sha256:41e7068e95fbf9ec94b41437f989caf9674135e770a39cdb9c00de459bafd1bc", + "sha256:47e5e1502d52ef03387cf9d3b3241007961a84a466e58a3b74028e1dd4957f8c", + "sha256:521340844cf388d109ceb61397f3fd5250ccb622a1a8e93559e8de76c80940a9", + "sha256:6c53338c1811f8c6d7f8cb7abd874810b15045e719e8207f957035c9177b4213", + "sha256:75c2dda47dcc3c77449712b1417bb6b89ec3b7b02e18c64262494dceffdf455e", + "sha256:773c5a98e463b52f7e8197254b39b703a5ea1972aef3a94b3b921515d77dd041", + "sha256:78c3068dcba300d473fef57cdf523e34b37de522f5a494ef9ee1ac9b4b8bbe3f", + "sha256:7bc18fc5a170f2c1cef5387a3d997c28942918bbee0f700e73fd2178ee8d474d", + "sha256:7f89eff20e4a7a64b55210dac17aea711ed8a3f2e78f2ff784c0e984302583dd", + "sha256:89458b49976b1dee5d89ab4ac943da3717b4292bf624367e862e4ee172fcce99", + "sha256:986f871c0fa649b293061236b93782d25c293a8dd8117c7ba05f8a61bdc261ae", + "sha256:a0f495a4fe5278aab278feee35e6102efecde5176a8a74dd28c28e3fc5c8d7c7", + "sha256:a14aa436586c41633339415de82a41164691d02d3e661038da533be5d40794a5", + "sha256:b8ab3ab38afc47d8f4fe629b836243544351cef681b6bdb1dc869028d6fdcbfb", + "sha256:bb487881608ebd293592553c618f0c83316f4f13a64cb18605b1d2fb9fd3da3e", + "sha256:c0b24bfe3431b3cb7ced323bca813dbd13aca973a1475b512d3331fd0de8ec60", + "sha256:c7894c06205166d360ab2915ae306d1f7403e9ce3d3aaeff4095eaf98e42ce66", + "sha256:d4039bb7f234ad32267c55e72fd49fb56078ea102f9d9d8559f6ec34d4887630", + "sha256:e4d6bb8703d0319eb04b7319b12ea41580df44fd84d83ccda13ea463c6801414", + "sha256:e8fab9911fd2fa8e5af407057cb8bdf87762f983cba483fa3234be20a9a0af77", + "sha256:f3818e578e687cdb21dc4aa4a3bc6278c656c9c393e9eda14dd04943f478863d", + "sha256:fe666645493d72712c46e4fbe8bec094b06aec3c337400479e9704439c9d9586" + ], + "markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2'", + "version": "==0.29.14" + }, "decorator": { "hashes": [ "sha256:41fa54c2a0cc4ba648be4fd43cff00aedf5b9465c9bf18d64325bc225f08f760", @@ -433,11 +479,11 @@ }, "isort": { "hashes": [ - "sha256:c729845434366216d320e936b8ad6f9d681aab72dc7cbc2d51bedc3582f3ad1e", - "sha256:fff4f0c04e1825522ce6949973e83110a6e907750cd92d128b0d14aaaadbffdc" + "sha256:0a943902919f65c5684ac4e0154b1ad4fac6dcaa5d9f3426b732f1c8b5419be6", + "sha256:2bb1680aad211e3c9944dbce1d4ba09a989f04e238296c87fe2139faa26d655d" ], "markers": "python_version >= '3.6' and python_version < '4'", - "version": "==5.7.0" + "version": "==5.8.0" }, "jedi": { "hashes": [ @@ -541,33 +587,31 @@ }, "lazy-object-proxy": { "hashes": [ - "sha256:1d33d6f789697f401b75ce08e73b1de567b947740f768376631079290118ad39", - "sha256:2f2de8f8ac0be3e40d17730e0600619d35c78c13a099ea91ef7fb4ad944ce694", - "sha256:3782931963dc89e0e9a0ae4348b44762e868ea280e4f8c233b537852a8996ab9", - "sha256:37d9c34b96cca6787fe014aeb651217944a967a5b165e2cacb6b858d2997ab84", - "sha256:38c3865bd220bd983fcaa9aa11462619e84a71233bafd9c880f7b1cb753ca7fa", - "sha256:429c4d1862f3fc37cd56304d880f2eae5bd0da83bdef889f3bd66458aac49128", - "sha256:522b7c94b524389f4a4094c4bf04c2b02228454ddd17c1a9b2801fac1d754871", - "sha256:57fb5c5504ddd45ed420b5b6461a78f58cbb0c1b0cbd9cd5a43ad30a4a3ee4d0", - "sha256:5944a9b95e97de1980c65f03b79b356f30a43de48682b8bdd90aa5089f0ec1f4", - "sha256:6f4e5e68b7af950ed7fdb594b3f19a0014a3ace0fedb86acb896e140ffb24302", - "sha256:71a1ef23f22fa8437974b2d60fedb947c99a957ad625f83f43fd3de70f77f458", - "sha256:8a44e9901c0555f95ac401377032f6e6af66d8fc1fbfad77a7a8b1a826e0b93c", - "sha256:b6577f15d5516d7d209c1a8cde23062c0f10625f19e8dc9fb59268859778d7d7", - "sha256:c8fe2d6ff0ff583784039d0255ea7da076efd08507f2be6f68583b0da32e3afb", - "sha256:cadfa2c2cf54d35d13dc8d231253b7985b97d629ab9ca6e7d672c35539d38163", - "sha256:cd1bdace1a8762534e9a36c073cd54e97d517a17d69a17985961265be6d22847", - "sha256:ddbdcd10eb999d7ab292677f588b658372aadb9a52790f82484a37127a390108", - "sha256:e7273c64bccfd9310e9601b8f4511d84730239516bada26a0c9846c9697617ef", - "sha256:e7428977763150b4cf83255625a80a23dfdc94d43be7791ce90799d446b4e26f", - "sha256:e960e8be509e8d6d618300a6c189555c24efde63e85acaf0b14b2cd1ac743315", - "sha256:ecb5dd5990cec6e7f5c9c1124a37cb2c710c6d69b0c1a5c4aa4b35eba0ada068", - "sha256:ef3f5e288aa57b73b034ce9c1f1ac753d968f9069cd0742d1d69c698a0167166", - "sha256:fa5b2dee0e231fa4ad117be114251bdfe6afe39213bd629d43deb117b6a6c40a", - "sha256:fa7fb7973c622b9e725bee1db569d2c2ee64d2f9a089201c5e8185d482c7352d" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'", - "version": "==1.5.2" + "sha256:17e0967ba374fc24141738c69736da90e94419338fd4c7c7bef01ee26b339653", + "sha256:1fee665d2638491f4d6e55bd483e15ef21f6c8c2095f235fef72601021e64f61", + "sha256:22ddd618cefe54305df49e4c069fa65715be4ad0e78e8d252a33debf00f6ede2", + "sha256:24a5045889cc2729033b3e604d496c2b6f588c754f7a62027ad4437a7ecc4837", + "sha256:410283732af311b51b837894fa2f24f2c0039aa7f220135192b38fcc42bd43d3", + "sha256:4732c765372bd78a2d6b2150a6e99d00a78ec963375f236979c0626b97ed8e43", + "sha256:489000d368377571c6f982fba6497f2aa13c6d1facc40660963da62f5c379726", + "sha256:4f60460e9f1eb632584c9685bccea152f4ac2130e299784dbaf9fae9f49891b3", + "sha256:5743a5ab42ae40caa8421b320ebf3a998f89c85cdc8376d6b2e00bd12bd1b587", + "sha256:85fb7608121fd5621cc4377a8961d0b32ccf84a7285b4f1d21988b2eae2868e8", + "sha256:9698110e36e2df951c7c36b6729e96429c9c32b3331989ef19976592c5f3c77a", + "sha256:9d397bf41caad3f489e10774667310d73cb9c4258e9aed94b9ec734b34b495fd", + "sha256:b579f8acbf2bdd9ea200b1d5dea36abd93cabf56cf626ab9c744a432e15c815f", + "sha256:b865b01a2e7f96db0c5d12cfea590f98d8c5ba64ad222300d93ce6ff9138bcad", + "sha256:bf34e368e8dd976423396555078def5cfc3039ebc6fc06d1ae2c5a65eebbcde4", + "sha256:c6938967f8528b3668622a9ed3b31d145fab161a32f5891ea7b84f6b790be05b", + "sha256:d1c2676e3d840852a2de7c7d5d76407c772927addff8d742b9808fe0afccebdf", + "sha256:d7124f52f3bd259f510651450e18e0fd081ed82f3c08541dffc7b94b883aa981", + "sha256:d900d949b707778696fdf01036f58c9876a0d8bfe116e8d220cfd4b15f14e741", + "sha256:ebfd274dcd5133e0afae738e6d9da4323c3eb021b3e13052d8cbd0e457b1256e", + "sha256:ed361bb83436f117f9917d282a456f9e5009ea12fd6de8742d1a4752c3017e93", + "sha256:f5144c75445ae3ca2057faac03fda5a902eff196702b0a24daf1d6ce0650514b" + ], + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'", + "version": "==1.6.0" }, "markupsafe": { "hashes": [ @@ -734,11 +778,11 @@ }, "notebook": { "hashes": [ - "sha256:0464b28e18e7a06cec37e6177546c2322739be07962dd13bf712bcb88361f013", - "sha256:25ad93c982b623441b491e693ef400598d1a46cdf11b8c9c0b3be6c61ebbb6cd" + "sha256:cb271af1e8134e3d6fc6d458bdc79c40cbfc84c1eb036a493f216d58f0880e92", + "sha256:cbc9398d6c81473e9cdb891d2cae9c0d3718fca289dda6d26df5cb660fcadc7d" ], - "markers": "python_version >= '3.5'", - "version": "==6.2.0" + "markers": "python_version >= '3.6'", + "version": "==6.3.0" }, "numpy": { "hashes": [ @@ -814,14 +858,6 @@ "markers": "python_version >= '3.6'", "version": "==0.8.1" }, - "pexpect": { - "hashes": [ - "sha256:0b48a55dcb3c05f3329815901ea4fc1537514d6ba867a152b581d69ae3710937", - "sha256:fc65a43959d153d0114afe13997d439c22823a27cefceb5ff35c2178c6784c0c" - ], - "markers": "sys_platform != 'win32'", - "version": "==4.8.0" - }, "pickleshare": { "hashes": [ "sha256:87683d47965c1da65cdacaf31c8441d12b8044cdec9aca500cd78fc2c683afca", @@ -914,11 +950,11 @@ }, "prompt-toolkit": { "hashes": [ - "sha256:4cea7d09e46723885cb8bc54678175453e5071e9449821dce6f017b1d1fbfc1a", - "sha256:9397a7162cf45449147ad6042fa37983a081b8a73363a5253dd4072666333137" + "sha256:bf00f22079f5fadc949f42ae8ff7f05702826a97059ffcc6281036ad40ac6f04", + "sha256:e1b4f11b9336a28fa11810bc623c357420f69dfdb6d2dac41ca2c21a55c033bc" ], "markers": "python_full_version >= '3.6.1'", - "version": "==3.0.17" + "version": "==3.0.18" }, "protobuf": { "hashes": [ @@ -945,14 +981,6 @@ ], "version": "==3.15.6" }, - "ptyprocess": { - "hashes": [ - "sha256:4b41f3967fce3af57cc7e94b888626c18bf37a083e3651ca8feeb66d492fef35", - "sha256:5c5d0a3b48ceee0b48485e0c26037c0acd7d29765ca3fbb5cb3831d347423220" - ], - "markers": "os_name != 'nt'", - "version": "==0.7.0" - }, "py": { "hashes": [ "sha256:21b81bda15b66ef5e1a777a21c4dcd9c20ad3efd0b3f817e7a809035269e1bd3", @@ -1057,6 +1085,38 @@ ], "version": "==2021.1" }, + "pywin32": { + "hashes": [ + "sha256:1c204a81daed2089e55d11eefa4826c05e604d27fe2be40b6bf8db7b6a39da63", + "sha256:27a30b887afbf05a9cbb05e3ffd43104a9b71ce292f64a635389dbad0ed1cd85", + "sha256:350c5644775736351b77ba68da09a39c760d75d2467ecec37bd3c36a94fbed64", + "sha256:60a8fa361091b2eea27f15718f8eb7f9297e8d51b54dbc4f55f3d238093d5190", + "sha256:638b68eea5cfc8def537e43e9554747f8dee786b090e47ead94bfdafdb0f2f50", + "sha256:8151e4d7a19262d6694162d6da85d99a16f8b908949797fd99c83a0bfaf5807d", + "sha256:a3b4c48c852d4107e8a8ec980b76c94ce596ea66d60f7a697582ea9dce7e0db7", + "sha256:b1609ce9bd5c411b81f941b246d683d6508992093203d4eb7f278f4ed1085c3f", + "sha256:d7e8c7efc221f10d6400c19c32a031add1c4a58733298c09216f57b4fde110dc", + "sha256:fbb3b1b0fbd0b4fc2a3d1d81fe0783e30062c1abed1d17c32b7879d55858cfae" + ], + "markers": "sys_platform == 'win32'", + "version": "==300" + }, + "pywinpty": { + "hashes": [ + "sha256:1e525a4de05e72016a7af27836d512db67d06a015aeaf2fa0180f8e6a039b3c2", + "sha256:2740eeeb59297593a0d3f762269b01d0285c1b829d6827445fcd348fb47f7e70", + "sha256:2d7e9c881638a72ffdca3f5417dd1563b60f603e1b43e5895674c2a1b01f95a0", + "sha256:33df97f79843b2b8b8bc5c7aaf54adec08cc1bae94ee99dfb1a93c7a67704d95", + "sha256:5fb2c6c6819491b216f78acc2c521b9df21e0f53b9a399d58a5c151a3c4e2a2d", + "sha256:8fc5019ff3efb4f13708bd3b5ad327589c1a554cb516d792527361525a7cb78c", + "sha256:b358cb552c0f6baf790de375fab96524a0498c9df83489b8c23f7f08795e966b", + "sha256:dbd838de92de1d4ebf0dce9d4d5e4fc38d0b7b1de837947a18b57a882f219139", + "sha256:dd22c8efacf600730abe4a46c1388355ce0d4ab75dc79b15d23a7bd87bf05b48", + "sha256:e854211df55d107f0edfda8a80b39dfc87015bef52a8fe6594eb379240d81df2" + ], + "markers": "os_name == 'nt'", + "version": "==0.5.7" + }, "pyzmq": { "hashes": [ "sha256:13465c1ff969cab328bc92f7015ce3843f6e35f8871ad79d236e4fbc85dbe4cb", @@ -1158,12 +1218,15 @@ "sha256:3c4f07f47c04e81b134424d53c3f5e16dfd7f494e44fd7584ba9ce9de2c5e6c1", "sha256:4562dcf4793e61c5d0f89836d07bc37521c3a1889da8f651e2c326463c4bd697", "sha256:4ddd2b6f7449a5d539ff754fa92d75da22de261fd8fdcfb3596799fadf255101", + "sha256:54be0a60a5a35005ad69c75902e0f5c9f699db4547ead427e97ef881c3242e6f", + "sha256:5580eba7345a4d3b097be2f067cc71a306c44bab19e8717a30361f279c929bea", "sha256:7b04691eb2f41d2c68dbda8d1bd3cb4ef421bdc43aaa56aeb6c762224552dfb6", "sha256:826b92bf45b8ad80444814e5f4ac032156dd481e48d7da33d611f8fe96d5f08b", "sha256:83b21ff053b1ff1c018a2d24db6dd3ea339b1acfbaa4d9c881731f43748d8b3b", "sha256:8772b99d683be8f67fcc04789032f1b949022a0e6880ee7b75a7ec97dbbb5d0b", "sha256:895dbf2030aa7337649e36a83a007df3c9811396b4e2fa672a851160f36ce90c", "sha256:8aa1b3ac46b80eaa552b637eeadbbce3be5931e4b5002b964698e33a1b589e1e", + "sha256:9599a3f3bf33f73fed0fe06d1dfa4e6081365a58c1c807acb07271be0dce9733", "sha256:99349d77f54e11f962d608d94dfda08f0c9e5720d97132233ebdf35be2858b2d", "sha256:9a24d1ccec2a34d4cd3f2a1f86409f3f5954cc23d4d2270ba0d03cf018aa4780", "sha256:9bed8a1ef133c8e2f13966a542cb8125eac7f4b67dcd234197c827ba9c7dd3e0", @@ -1172,6 +1235,7 @@ "sha256:a0334a1802e64d656022c3bfab56a73fbd6bf4b1298343f3688af2151810bbdf", "sha256:a29460499c1e62b7a830bb57ca42e615375a6ab1bcad053cd25b493588348ea8", "sha256:a36e159a0521e13bbe15ca8c8d038b3a1dd4c7dad18d276d76992e03b92cf643", + "sha256:abe835a851610f87201819cb315f8d554e1a3e8128912783a31e87264ba5ffb7", "sha256:c13ebac42236b1c46397162471ea1c46af68413000e28b9309f8c05722c65a09", "sha256:c3deb3b19dd9806acf00cf0d400e84562c227723013c33abefbbc3cf906596e9", "sha256:c658432d8a20e95398f6bb95ff9731ce9dfa343fdf21eea7ec6a7edfacd4b4d9", @@ -1449,6 +1513,29 @@ ], "version": "==0.8.2" }, + "watchdog": { + "hashes": [ + "sha256:035f4816daf3c62e03503c267620f3aa8fc7472df85ff3ef1e0c100ea1ed2744", + "sha256:0f7e9de9ba84af15e9e9fc29c3b13c972daa4d2b11de29aa86b26a26bc877c06", + "sha256:13c9ff58508dce55ba416eb0ef7af5aa5858558f2ec51112f099fd03503b670b", + "sha256:19675b8d1f00dabe74a0e66d87980623250d9360a21612e8c27b70a4b214ceeb", + "sha256:1cd715c4fb803581ded8943f39a51f21c17375d009ca9e3398d6b20638863a70", + "sha256:1f518a6940cde8720b8826a705c164e6b9bd6cf8c00f14269ffac51e017e06ec", + "sha256:3e933f3567c4521dd1a5d59fd54a522cae90bebcbeb8b74b84a2f33c90f08388", + "sha256:41b1a773f364f232b5bc184688e8d60451745d9e0971ac60c648bd47be8f4733", + "sha256:532fedd993e75554671faa36cd04c580ced3fae084254a779afbbd8aaf00566b", + "sha256:74528772516228f6a015a647027057939ff0b695a0b864cb3037e8e1aabc7ca0", + "sha256:89102465764e453609463cf620e744da1b0aa1f9f321b05961e2e7e15b3c9d8b", + "sha256:a412b1914e27f67b0a10e1ee19b5d035a9f7c115a062bbbd640653d9820ba4c8", + "sha256:ac6adbdf32e1d180574f9d0819e80259ae48e68727e80c3d950ed5a023714c3e", + "sha256:adda34bfe6db05485c1dfcd98232bdec385f991fe16358750c2163473eefb985", + "sha256:d2fcbc15772a82cd139c803a513c45b0fbc72a10a8a34dc2a8b429110b6f1236", + "sha256:d54e187b76053982180532cb7fd31152201c438b348c456f699929f8a89e786d", + "sha256:e0114e48ee981b38e328eaa0d5a625c7b4fc144b8dc7f7637749d6b5f7fefb0e" + ], + "markers": "platform_system != 'Darwin'", + "version": "==2.0.2" + }, "wcwidth": { "hashes": [ "sha256:beb4802a9cebb9144e99086eff703a642a13d6a0052920003a230f3294bbe784", @@ -1485,6 +1572,14 @@ ], "version": "==1.4.4" }, + "atomicwrites": { + "hashes": [ + "sha256:6d1784dea7c0c8d4a5172b6c620f40b6e4cbfdf96d783691f2e1302a7b88e197", + "sha256:ae70396ad1a434f9c7046fd2dd196fc04b12f9e91ffb859164193be8b6168a7a" + ], + "markers": "sys_platform == 'win32'", + "version": "==1.4.0" + }, "attrs": { "hashes": [ "sha256:31b2eced602aa8423c2aea9c76a724617ed67cf9513173fd3a4f03e3a929c7e6", @@ -1508,6 +1603,14 @@ "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'", "version": "==7.1.2" }, + "colorama": { + "hashes": [ + "sha256:5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b", + "sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2" + ], + "markers": "sys_platform == 'win32' and sys_platform == 'win32' and sys_platform == 'win32'", + "version": "==0.4.4" + }, "coverage": { "hashes": [ "sha256:004d1880bed2d97151facef49f08e255a20ceb6f9432df75f4eef018fdd5a78c", diff --git a/streamlit_web.py b/streamlit_web.py index 02f207c3..6cb08d55 100644 --- a/streamlit_web.py +++ b/streamlit_web.py @@ -55,6 +55,7 @@ def main(): "Summary", "Topic Modeling", "Interactive", + "Entity Analysis", ], ) if debug_mode: @@ -81,6 +82,9 @@ def main(): elif analysis_mode == "Interactive": st.title(analysis_mode) interactive() + elif analysis_mode == "Entity Analysis": + st.title(analysis_mode) + entities() success_msg.empty() @@ -641,5 +645,11 @@ def interactive(): st.write(summaries) +def entities(): + """Page to display entity analysis""" + st.header("Hello world!") + st.sidebar.success("Hello sidebar!") + + if __name__ == "__main__": main() From 2ab081f3c6c5ea97a04c29c26a95943299a3d8b1 Mon Sep 17 00:00:00 2001 From: Nati Date: Wed, 31 Mar 2021 15:30:19 -0400 Subject: [PATCH 02/22] added some functionality to entities, but is currently not working --- streamlit_web.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/streamlit_web.py b/streamlit_web.py index 6cb08d55..268f8d0d 100644 --- a/streamlit_web.py +++ b/streamlit_web.py @@ -6,6 +6,7 @@ import pandas as pd from sklearn.manifold import TSNE import spacy +from spacy import displacy import streamlit as st from textblob import TextBlob @@ -650,6 +651,17 @@ def entities(): st.header("Hello world!") st.sidebar.success("Hello sidebar!") + input_df = main_df.copy(deep=True) + students = st.multiselect( + label="Select specific students below:", + options=input_df[stu_id].unique(), + ) + df_selected_stu = input_df.loc[input_df[stu_id].isin(students)] + + if len(students) != 0: + nlpff = spacy.load("en_core_web_sm") + docff = nlpff(df_selected_stu) + displacy.serve(docff, style="ent") if __name__ == "__main__": main() From 66ed2ecf3961ceb81682cfc848cd8cf29bc9968b Mon Sep 17 00:00:00 2001 From: KM Date: Wed, 31 Mar 2021 15:36:55 -0400 Subject: [PATCH 03/22] description of entity analysis --- streamlit_web.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/streamlit_web.py b/streamlit_web.py index 268f8d0d..d5548069 100644 --- a/streamlit_web.py +++ b/streamlit_web.py @@ -648,7 +648,7 @@ def interactive(): def entities(): """Page to display entity analysis""" - st.header("Hello world!") + st.header("Entity analysis inspects the given text for known entities and returns information about those entities. It is a way to extract information that seeks to locate and classify named entities in text into pre-defined categories such as the names of persons, organizations, locations, expressions of times, quantities, monetary values, and percentages.") st.sidebar.success("Hello sidebar!") input_df = main_df.copy(deep=True) From 2bcd550e8593cef1ea58bc9ed2bfea7441e35254 Mon Sep 17 00:00:00 2001 From: KM Date: Sun, 4 Apr 2021 20:53:10 -0400 Subject: [PATCH 04/22] added df to string code --- streamlit_web.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/streamlit_web.py b/streamlit_web.py index d5548069..80179020 100644 --- a/streamlit_web.py +++ b/streamlit_web.py @@ -648,7 +648,11 @@ def interactive(): def entities(): """Page to display entity analysis""" - st.header("Entity analysis inspects the given text for known entities and returns information about those entities. It is a way to extract information that seeks to locate and classify named entities in text into pre-defined categories such as the names of persons, organizations, locations, expressions of times, quantities, monetary values, and percentages.") + st.header("Entity analysis inspects the given text for known entities \ + and returns information about those entities. It is a way to extract \ + information that seeks to locate and classify named entities in text \ + into pre-defined categories such as the names of persons, organizations, \ + locations, expressions of times, quantities, monetary values, and percentages.") st.sidebar.success("Hello sidebar!") input_df = main_df.copy(deep=True) @@ -657,10 +661,10 @@ def entities(): options=input_df[stu_id].unique(), ) df_selected_stu = input_df.loc[input_df[stu_id].isin(students)] + student_string = df_selected_stu.to_string() if len(students) != 0: - nlpff = spacy.load("en_core_web_sm") - docff = nlpff(df_selected_stu) + docff = az.get_nlp(student_string) displacy.serve(docff, style="ent") if __name__ == "__main__": From 3f43cac5e6c1eb629ee9700fda9025db4fa520c5 Mon Sep 17 00:00:00 2001 From: KM Date: Sun, 4 Apr 2021 21:09:39 -0400 Subject: [PATCH 05/22] added more code to entities function --- streamlit_web.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/streamlit_web.py b/streamlit_web.py index 80179020..0fe4ac2a 100644 --- a/streamlit_web.py +++ b/streamlit_web.py @@ -660,12 +660,23 @@ def entities(): label="Select specific students below:", options=input_df[stu_id].unique(), ) + df_selected_stu = input_df.loc[input_df[stu_id].isin(students)] student_string = df_selected_stu.to_string() - + # st.write(student_string) if len(students) != 0: docff = az.get_nlp(student_string) - displacy.serve(docff, style="ent") + named_entities = az.named_entity_recognization(student_string) + if len(named_entities) > 0: + html = spacy.displacy.render(docff, style="ent") + # Newlines seem to mess with the rendering + html = html.replace("\n", " ") + HTML_WRAPPER = """
\ + {}
""" + st.write(HTML_WRAPPER.format(html), unsafe_allow_html=True) + else: + st.info("No named entity recognized") if __name__ == "__main__": main() From 9be8f063a764afbd81905cc2d50d94cca7d294cb Mon Sep 17 00:00:00 2001 From: KM Date: Sun, 4 Apr 2021 21:26:22 -0400 Subject: [PATCH 06/22] entities giving correct output --- streamlit_web.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/streamlit_web.py b/streamlit_web.py index 0fe4ac2a..8ee2a295 100644 --- a/streamlit_web.py +++ b/streamlit_web.py @@ -656,6 +656,7 @@ def entities(): st.sidebar.success("Hello sidebar!") input_df = main_df.copy(deep=True) + # make a single select, filter by question, differntiate by parts, define more entities students = st.multiselect( label="Select specific students below:", options=input_df[stu_id].unique(), @@ -663,20 +664,21 @@ def entities(): df_selected_stu = input_df.loc[input_df[stu_id].isin(students)] student_string = df_selected_stu.to_string() + # st.write(student_string) if len(students) != 0: docff = az.get_nlp(student_string) - named_entities = az.named_entity_recognization(student_string) - if len(named_entities) > 0: - html = spacy.displacy.render(docff, style="ent") - # Newlines seem to mess with the rendering - html = html.replace("\n", " ") - HTML_WRAPPER = """
\ - {}
""" - st.write(HTML_WRAPPER.format(html), unsafe_allow_html=True) - else: - st.info("No named entity recognized") + # named_entities = az.named_entity_recognization(student_string) + # if len(named_entities) > 0: + html = spacy.displacy.render(docff, style="ent") + # Newlines seem to mess with the rendering + html = html.replace("\n", " ") + HTML_WRAPPER = """
\ + {}
""" + st.write(HTML_WRAPPER.format(html), unsafe_allow_html=True) + # else: + # st.info("No named entity recognized") if __name__ == "__main__": main() From 5de1685dda9b1caaa07297bf7b7088e54262292f Mon Sep 17 00:00:00 2001 From: Nati Date: Wed, 7 Apr 2021 15:16:19 -0400 Subject: [PATCH 07/22] cleaned up the code and added some comments --- streamlit_web.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/streamlit_web.py b/streamlit_web.py index 8ee2a295..9d34a1ed 100644 --- a/streamlit_web.py +++ b/streamlit_web.py @@ -655,30 +655,29 @@ def entities(): locations, expressions of times, quantities, monetary values, and percentages.") st.sidebar.success("Hello sidebar!") + # make a copy of the main dataframe input_df = main_df.copy(deep=True) - # make a single select, filter by question, differntiate by parts, define more entities + + # list out possible user documents to choose from and select one students = st.multiselect( label="Select specific students below:", options=input_df[stu_id].unique(), ) + # create a dataframe with the selected user and convert it to a string df_selected_stu = input_df.loc[input_df[stu_id].isin(students)] student_string = df_selected_stu.to_string() - # st.write(student_string) + # run the spacy entity recogonizer on the selected user document and display it if len(students) != 0: docff = az.get_nlp(student_string) - # named_entities = az.named_entity_recognization(student_string) - # if len(named_entities) > 0: html = spacy.displacy.render(docff, style="ent") - # Newlines seem to mess with the rendering html = html.replace("\n", " ") HTML_WRAPPER = """
\ {}
""" st.write(HTML_WRAPPER.format(html), unsafe_allow_html=True) - # else: - # st.info("No named entity recognized") + if __name__ == "__main__": main() From 765f57fb152e94b60afffe31442449577f3eea9c Mon Sep 17 00:00:00 2001 From: leflocha Date: Sun, 11 Apr 2021 20:06:48 -0400 Subject: [PATCH 08/22] started pandas.py --- src/pandas.py | 15 +++++++++++++++ streamlit_web.py | 16 +++++++++------- 2 files changed, 24 insertions(+), 7 deletions(-) create mode 100644 src/pandas.py diff --git a/src/pandas.py b/src/pandas.py new file mode 100644 index 00000000..72cdc38c --- /dev/null +++ b/src/pandas.py @@ -0,0 +1,15 @@ +import pandas as pd +import src.visualization as vis + + +def basic_frame(): + """A basic dataframe with no frills""" + return pd.DataFrame() + +def importpanda(import_data): + raw_df = pd.DataFrame() + for item in import_data: + single_df = pd.DataFrame(item) + raw_df = pd.concat([raw_df, single_df]).fillna("") + tidy_df = df_preprocess(raw_df) + return tidy_df, raw_df \ No newline at end of file diff --git a/streamlit_web.py b/streamlit_web.py index 8ee2a295..d675b2cb 100644 --- a/streamlit_web.py +++ b/streamlit_web.py @@ -19,6 +19,7 @@ import src.summarizer as sz import src.topic_modeling as tm import src.visualization as vis +import src.pandas as pan # resources/sample_reflections/lab1, resources/sample_reflections/lab2 @@ -178,12 +179,13 @@ def import_data(data_retreive_method, paths): st.markdown(readme_file.read()) # when data is retreived if json_lst: - raw_df = pd.DataFrame() - for item in json_lst: - single_df = pd.DataFrame(item) - raw_df = pd.concat([raw_df, single_df]).fillna("") - tidy_df = df_preprocess(raw_df) - return tidy_df, raw_df + pan.importpanda(json_lst) + # raw_df = pd.DataFrame() + # for item in json_lst: + # single_df = pd.DataFrame(item) + # raw_df = pd.concat([raw_df, single_df]).fillna("") + # tidy_df = df_preprocess(raw_df) + # return tidy_df, raw_df def df_preprocess(df): @@ -648,7 +650,7 @@ def interactive(): def entities(): """Page to display entity analysis""" - st.header("Entity analysis inspects the given text for known entities \ + st.write("Entity analysis inspects the given text for known entities \ and returns information about those entities. It is a way to extract \ information that seeks to locate and classify named entities in text \ into pre-defined categories such as the names of persons, organizations, \ From c86ee83d3d0ac5020edbbe178b7402ca29eca8f3 Mon Sep 17 00:00:00 2001 From: Nati Date: Sun, 18 Apr 2021 15:23:54 -0400 Subject: [PATCH 09/22] removed unneeded sidebar message --- streamlit_web.py | 1 - 1 file changed, 1 deletion(-) diff --git a/streamlit_web.py b/streamlit_web.py index 778adde9..b291a69a 100644 --- a/streamlit_web.py +++ b/streamlit_web.py @@ -666,7 +666,6 @@ def entities(): information that seeks to locate and classify named entities in text \ into pre-defined categories such as the names of persons, organizations, \ locations, expressions of times, quantities, monetary values, and percentages.") - st.sidebar.success("Hello sidebar!") # make a copy of the main dataframe input_df = main_df.copy(deep=True) From f2fdb70c4d100049f0c4dab96c84867babf9cc89 Mon Sep 17 00:00:00 2001 From: Nati Date: Sun, 18 Apr 2021 15:29:31 -0400 Subject: [PATCH 10/22] moved entity analysis up on the list order of the streamlit sidebar --- streamlit_web.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/streamlit_web.py b/streamlit_web.py index b291a69a..1b338eff 100644 --- a/streamlit_web.py +++ b/streamlit_web.py @@ -55,11 +55,11 @@ def main(): "Home", "Frequency Analysis", "Sentiment Analysis", + "Entity Analysis", "Document Similarity", "Summary", "Topic Modeling", "Interactive", - "Entity Analysis", ], ) if debug_mode: @@ -190,13 +190,13 @@ def import_data(data_retreive_method, paths): readme() # when data is retreived if json_lst: - pan.importpanda(json_lst) - # raw_df = pd.DataFrame() - # for item in json_lst: - # single_df = pd.DataFrame(item) - # raw_df = pd.concat([raw_df, single_df]).fillna("") - # tidy_df = df_preprocess(raw_df) - # return tidy_df, raw_df + # pan.importpanda(json_lst) + raw_df = pd.DataFrame() + for item in json_lst: + single_df = pd.DataFrame(item) + raw_df = pd.concat([raw_df, single_df]).fillna("") + tidy_df = df_preprocess(raw_df) + return tidy_df, raw_df def df_preprocess(df): From 286d554b0473f5dc06eae3b293fbec9ad952bb6a Mon Sep 17 00:00:00 2001 From: Nati Date: Sun, 18 Apr 2021 15:37:52 -0400 Subject: [PATCH 11/22] made a separate function for the displacy renderer in analyzer --- src/analyzer.py | 12 ++++++++++++ src/pandas.py | 30 +++++++++++++++--------------- streamlit_web.py | 21 +++------------------ 3 files changed, 30 insertions(+), 33 deletions(-) diff --git a/src/analyzer.py b/src/analyzer.py index b686b255..180b5698 100644 --- a/src/analyzer.py +++ b/src/analyzer.py @@ -5,6 +5,7 @@ from typing import List, Tuple import spacy from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer +import streamlit as st from . import markdown as md @@ -130,6 +131,17 @@ def get_nlp(input_text): doc = PARSER(input_text) return doc +def displacy_renderer(doc): + if len(doc) > 0: + html = spacy.displacy.render(doc, style="ent") + # Newlines seem to mess with the rendering + html = html.replace("\n", " ") + HTML_WRAPPER = """
\ + {}
""" + st.write(HTML_WRAPPER.format(html), unsafe_allow_html=True) + else: + st.info("No named entity recognized") def noun_phrase(input_text): """Extract noun phrases of the document in a list""" diff --git a/src/pandas.py b/src/pandas.py index 72cdc38c..0886a6f1 100644 --- a/src/pandas.py +++ b/src/pandas.py @@ -1,15 +1,15 @@ -import pandas as pd -import src.visualization as vis - - -def basic_frame(): - """A basic dataframe with no frills""" - return pd.DataFrame() - -def importpanda(import_data): - raw_df = pd.DataFrame() - for item in import_data: - single_df = pd.DataFrame(item) - raw_df = pd.concat([raw_df, single_df]).fillna("") - tidy_df = df_preprocess(raw_df) - return tidy_df, raw_df \ No newline at end of file +# import pandas as pd +# import src.visualization as vis +# +# +# def basic_frame(): +# """A basic dataframe with no frills""" +# return pd.DataFrame() +# +# def importpanda(import_data): +# raw_df = pd.DataFrame() +# for item in import_data: +# single_df = pd.DataFrame(item) +# raw_df = pd.concat([raw_df, single_df]).fillna("") +# tidy_df = df_preprocess(raw_df) +# return tidy_df, raw_df diff --git a/streamlit_web.py b/streamlit_web.py index 1b338eff..a1306d0a 100644 --- a/streamlit_web.py +++ b/streamlit_web.py @@ -641,16 +641,7 @@ def interactive(): if ner_cb: doc = az.get_nlp(input_text) named_entities = az.named_entity_recognization(input_text) - if len(named_entities) > 0: - html = spacy.displacy.render(doc, style="ent") - # Newlines seem to mess with the rendering - html = html.replace("\n", " ") - HTML_WRAPPER = """
\ - {}
""" - st.write(HTML_WRAPPER.format(html), unsafe_allow_html=True) - else: - st.info("No named entity recognized") + az.displacy_renderer(named_entities) if sentiment_cb: sentiments = TextBlob(az.lemmatized_text(input_text)) st.write(sentiments.sentiment) @@ -681,14 +672,8 @@ def entities(): student_string = df_selected_stu.to_string() # run the spacy entity recogonizer on the selected user document and display it - if len(students) != 0: - docff = az.get_nlp(student_string) - html = spacy.displacy.render(docff, style="ent") - html = html.replace("\n", " ") - HTML_WRAPPER = """
\ - {}
""" - st.write(HTML_WRAPPER.format(html), unsafe_allow_html=True) + docff = az.get_nlp(student_string) + az.displacy_renderer(docff) if __name__ == "__main__": From e5e0b0abb332bbd73363554c6bce44afa2bfc7cf Mon Sep 17 00:00:00 2001 From: Nati Date: Sun, 18 Apr 2021 22:31:28 -0400 Subject: [PATCH 12/22] removed pandas.py from this branch --- src/pandas.py | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 src/pandas.py diff --git a/src/pandas.py b/src/pandas.py deleted file mode 100644 index 0886a6f1..00000000 --- a/src/pandas.py +++ /dev/null @@ -1,15 +0,0 @@ -# import pandas as pd -# import src.visualization as vis -# -# -# def basic_frame(): -# """A basic dataframe with no frills""" -# return pd.DataFrame() -# -# def importpanda(import_data): -# raw_df = pd.DataFrame() -# for item in import_data: -# single_df = pd.DataFrame(item) -# raw_df = pd.concat([raw_df, single_df]).fillna("") -# tidy_df = df_preprocess(raw_df) -# return tidy_df, raw_df From c46e31d881381d78133635900721e1543c6aa046 Mon Sep 17 00:00:00 2001 From: Nati Date: Sun, 18 Apr 2021 22:33:22 -0400 Subject: [PATCH 13/22] made it so that only one user can be selected at a time --- streamlit_web.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/streamlit_web.py b/streamlit_web.py index a1306d0a..2efb1e55 100644 --- a/streamlit_web.py +++ b/streamlit_web.py @@ -659,16 +659,16 @@ def entities(): locations, expressions of times, quantities, monetary values, and percentages.") # make a copy of the main dataframe - input_df = main_df.copy(deep=True) + input_df = preprocessed_df.copy(deep=True) # list out possible user documents to choose from and select one - students = st.multiselect( + students = st.selectbox( label="Select specific students below:", options=input_df[stu_id].unique(), ) # create a dataframe with the selected user and convert it to a string - df_selected_stu = input_df.loc[input_df[stu_id].isin(students)] + df_selected_stu = input_df.loc[input_df[stu_id].isin([students])] student_string = df_selected_stu.to_string() # run the spacy entity recogonizer on the selected user document and display it From a168b32628af4c61ffa827ef8ecc54ab1f0841ff Mon Sep 17 00:00:00 2001 From: Nati Date: Sun, 18 Apr 2021 23:07:12 -0400 Subject: [PATCH 14/22] fixed linting errors --- src/analyzer.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/analyzer.py b/src/analyzer.py index 180b5698..b8c93689 100644 --- a/src/analyzer.py +++ b/src/analyzer.py @@ -131,6 +131,7 @@ def get_nlp(input_text): doc = PARSER(input_text) return doc + def displacy_renderer(doc): if len(doc) > 0: html = spacy.displacy.render(doc, style="ent") @@ -143,6 +144,7 @@ def displacy_renderer(doc): else: st.info("No named entity recognized") + def noun_phrase(input_text): """Extract noun phrases of the document in a list""" doc = PARSER(input_text) From cb95f2adfef501f099e8426550a9b3eb67ebfd05 Mon Sep 17 00:00:00 2001 From: Nati Date: Sun, 18 Apr 2021 23:13:57 -0400 Subject: [PATCH 15/22] provided description of the displacy_renderer function --- src/analyzer.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/analyzer.py b/src/analyzer.py index b8c93689..d104b04e 100644 --- a/src/analyzer.py +++ b/src/analyzer.py @@ -133,6 +133,7 @@ def get_nlp(input_text): def displacy_renderer(doc): + """runs the spacy displacy function on the given string and renders the output""" if len(doc) > 0: html = spacy.displacy.render(doc, style="ent") # Newlines seem to mess with the rendering From fcc4305c6c55be71aa546f7b8919626c8db72696 Mon Sep 17 00:00:00 2001 From: Nati Date: Wed, 21 Apr 2021 13:14:11 -0400 Subject: [PATCH 16/22] last issue resolved --- src/analyzer.py | 3 ++- streamlit_web.py | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/analyzer.py b/src/analyzer.py index d104b04e..a94bfdc6 100644 --- a/src/analyzer.py +++ b/src/analyzer.py @@ -133,7 +133,8 @@ def get_nlp(input_text): def displacy_renderer(doc): - """runs the spacy displacy function on the given string and renders the output""" + """runs the spacy displacy function on the given string and + renders the output""" if len(doc) > 0: html = spacy.displacy.render(doc, style="ent") # Newlines seem to mess with the rendering diff --git a/streamlit_web.py b/streamlit_web.py index 2efb1e55..5967188e 100644 --- a/streamlit_web.py +++ b/streamlit_web.py @@ -21,7 +21,6 @@ import src.summarizer as sz import src.topic_modeling as tm import src.visualization as vis -import src.pandas as pan # resources/sample_reflections/lab1, resources/sample_reflections/lab2 @@ -668,8 +667,13 @@ def entities(): ) # create a dataframe with the selected user and convert it to a string - df_selected_stu = input_df.loc[input_df[stu_id].isin([students])] - student_string = df_selected_stu.to_string() + df_selected_stu = input_df.loc[ + input_df[stu_id].isin([students]) + & input_df[assign_id].isin(assignments) + ] + + student_string = df_selected_stu.to_string(header=False, index=False, na_rep="") + student_string = student_string.replace("\\n","") # run the spacy entity recogonizer on the selected user document and display it docff = az.get_nlp(student_string) From 8efcb90e2a7ee1aa7890456d6ce348cf60ec626d Mon Sep 17 00:00:00 2001 From: Nati Date: Tue, 27 Apr 2021 18:25:45 -0400 Subject: [PATCH 17/22] moved display_renderer function to streamlit --- src/analyzer.py | 16 ---------------- streamlit_web.py | 18 ++++++++++++++++-- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/analyzer.py b/src/analyzer.py index a94bfdc6..b686b255 100644 --- a/src/analyzer.py +++ b/src/analyzer.py @@ -5,7 +5,6 @@ from typing import List, Tuple import spacy from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer -import streamlit as st from . import markdown as md @@ -132,21 +131,6 @@ def get_nlp(input_text): return doc -def displacy_renderer(doc): - """runs the spacy displacy function on the given string and - renders the output""" - if len(doc) > 0: - html = spacy.displacy.render(doc, style="ent") - # Newlines seem to mess with the rendering - html = html.replace("\n", " ") - HTML_WRAPPER = """
\ - {}
""" - st.write(HTML_WRAPPER.format(html), unsafe_allow_html=True) - else: - st.info("No named entity recognized") - - def noun_phrase(input_text): """Extract noun phrases of the document in a list""" doc = PARSER(input_text) diff --git a/streamlit_web.py b/streamlit_web.py index 5967188e..bf67d295 100644 --- a/streamlit_web.py +++ b/streamlit_web.py @@ -189,7 +189,6 @@ def import_data(data_retreive_method, paths): readme() # when data is retreived if json_lst: - # pan.importpanda(json_lst) raw_df = pd.DataFrame() for item in json_lst: single_df = pd.DataFrame(item) @@ -677,7 +676,22 @@ def entities(): # run the spacy entity recogonizer on the selected user document and display it docff = az.get_nlp(student_string) - az.displacy_renderer(docff) + displacy_renderer(docff) + + +def displacy_renderer(doc): + """runs the spacy displacy function on the given string and + renders the output""" + if len(doc) > 0: + html = spacy.displacy.render(doc, style="ent") + # Newlines seem to mess with the rendering + html = html.replace("\n", " ") + HTML_WRAPPER = """
\ + {}
""" + st.write(HTML_WRAPPER.format(html), unsafe_allow_html=True) + else: + st.info("No named entity recognized") if __name__ == "__main__": From 60efc98444f818a4689b43cca77cd28ad1a77c6f Mon Sep 17 00:00:00 2001 From: Nati Date: Tue, 27 Apr 2021 23:06:27 -0400 Subject: [PATCH 18/22] managed to narrow down the output of entity analysis to relevant parts --- streamlit_web.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/streamlit_web.py b/streamlit_web.py index 34809f1a..53e140cd 100644 --- a/streamlit_web.py +++ b/streamlit_web.py @@ -673,7 +673,8 @@ def entities(): & input_df[assign_id].isin(assignments) ] - student_string = df_selected_stu.to_string(header=False, index=False, na_rep="") + df_selected_stu_combined = df_selected_stu.iloc[:, 15:16] + student_string = df_selected_stu_combined.to_string(header=False, index=False, na_rep="") student_string = student_string.replace("\\n","") # run the spacy entity recogonizer on the selected user document and display it From 5359dda0e7bba68704324a481fccb7004b63ffdb Mon Sep 17 00:00:00 2001 From: Nati Date: Wed, 28 Apr 2021 13:05:22 -0400 Subject: [PATCH 19/22] made a drop down list to select user's reflections --- streamlit_web.py | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/streamlit_web.py b/streamlit_web.py index 53e140cd..af012d9e 100644 --- a/streamlit_web.py +++ b/streamlit_web.py @@ -659,22 +659,31 @@ def entities(): locations, expressions of times, quantities, monetary values, and percentages.") # make a copy of the main dataframe - input_df = preprocessed_df.copy(deep=True) + input_df = main_df.copy(deep=True) + input_df = input_df[input_df[assign_id].isin(assignments)] - # list out possible user documents to choose from and select one - students = st.selectbox( - label="Select specific students below:", - options=input_df[stu_id].unique(), - ) + # makes a drop down list to select users classified by assignments + for assignment in input_df[assign_id].unique(): + st.write("") + st.write(assignment) + for student in input_df[stu_id].unique(): + with st.beta_expander(student): + st.write(entity_analysis(assignment, student)) + + +def entity_analysis(assignment, student): + # make a copy of the main dataframe + input_df = preprocessed_df.copy(deep=True) - # create a dataframe with the selected user and convert it to a string + # makes a dataframe with the selected user's information df_selected_stu = input_df.loc[ - input_df[stu_id].isin([students]) - & input_df[assign_id].isin(assignments) + input_df[stu_id].isin([student]) + & input_df[assign_id].isin([assignment]) ] + # selects the combined column from the dataframe and converts to string df_selected_stu_combined = df_selected_stu.iloc[:, 15:16] - student_string = df_selected_stu_combined.to_string(header=False, index=False, na_rep="") + student_string = df_selected_stu_combined.to_string(header=False, index=False) student_string = student_string.replace("\\n","") # run the spacy entity recogonizer on the selected user document and display it From 4f9beaddf2c23f40d55f875d898c34a8c7f9c45c Mon Sep 17 00:00:00 2001 From: Nati Date: Wed, 28 Apr 2021 13:10:01 -0400 Subject: [PATCH 20/22] added description for entity analysis function --- streamlit_web.py | 1 + 1 file changed, 1 insertion(+) diff --git a/streamlit_web.py b/streamlit_web.py index af012d9e..43dd206a 100644 --- a/streamlit_web.py +++ b/streamlit_web.py @@ -672,6 +672,7 @@ def entities(): def entity_analysis(assignment, student): + """function that selects, modifies and runs the entity analysis on a document""" # make a copy of the main dataframe input_df = preprocessed_df.copy(deep=True) From 3a8fa0dd7e79a0bca071ed089db550bbc4d50c2c Mon Sep 17 00:00:00 2001 From: Nati Date: Wed, 28 Apr 2021 15:12:30 -0400 Subject: [PATCH 21/22] resolved issues that were pointed out --- streamlit_web.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/streamlit_web.py b/streamlit_web.py index ca8d6982..6d0ca09d 100644 --- a/streamlit_web.py +++ b/streamlit_web.py @@ -686,16 +686,14 @@ def entities(): # makes a drop down list to select users classified by assignments for assignment in input_df[assign_id].unique(): st.write("") - st.write(assignment) + st.subheader(assignment) for student in input_df[stu_id].unique(): with st.beta_expander(student): - st.write(entity_analysis(assignment, student)) + entity_analysis(assignment, student, input_df) -def entity_analysis(assignment, student): +def entity_analysis(assignment, student, input_df): """function that selects, modifies and runs the entity analysis on a document""" - # make a copy of the main dataframe - input_df = preprocessed_df.copy(deep=True) # makes a dataframe with the selected user's information df_selected_stu = input_df.loc[ @@ -703,8 +701,11 @@ def entity_analysis(assignment, student): & input_df[assign_id].isin([assignment]) ] - # selects the combined column from the dataframe and converts to string - df_selected_stu_combined = df_selected_stu.iloc[:, 15:16] + # selects the combined column from the dataframe and extracts it + combine_start = df_selected_stu.columns.get_loc("combined") + combine_end = df_selected_stu.columns.get_loc("combined") + 2 + df_selected_stu_combined = df_selected_stu.iloc[:,combine_start:combine_end] + # convert the combined dataframe into a string student_string = df_selected_stu_combined.to_string(header=False, index=False) student_string = student_string.replace("\\n","") From 3e6b8a6007911b105e761978f4948fd07c6465af Mon Sep 17 00:00:00 2001 From: Nati Date: Wed, 28 Apr 2021 23:19:03 -0400 Subject: [PATCH 22/22] fixed issues so that it gives correct list of students & correct output --- streamlit_web.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/streamlit_web.py b/streamlit_web.py index 6d0ca09d..52121c7a 100644 --- a/streamlit_web.py +++ b/streamlit_web.py @@ -687,7 +687,8 @@ def entities(): for assignment in input_df[assign_id].unique(): st.write("") st.subheader(assignment) - for student in input_df[stu_id].unique(): + df_selected_assign = input_df.loc[input_df[assign_id].isin([assignment])] + for student in df_selected_assign[stu_id].unique(): with st.beta_expander(student): entity_analysis(assignment, student, input_df) @@ -703,15 +704,15 @@ def entity_analysis(assignment, student, input_df): # selects the combined column from the dataframe and extracts it combine_start = df_selected_stu.columns.get_loc("combined") - combine_end = df_selected_stu.columns.get_loc("combined") + 2 + combine_end = df_selected_stu.columns.get_loc("combined") + 1 df_selected_stu_combined = df_selected_stu.iloc[:,combine_start:combine_end] # convert the combined dataframe into a string student_string = df_selected_stu_combined.to_string(header=False, index=False) student_string = student_string.replace("\\n","") # run the spacy entity recogonizer on the selected user document and display it - docff = az.get_nlp(student_string) - displacy_renderer(docff) + doc = az.get_nlp(student_string) + displacy_renderer(doc) def displacy_renderer(doc):