Gosse Minnema
commited on
Commit
·
2922ea1
1
Parent(s):
2ed0414
First public, anonymized version
Browse files- README.md +4 -3
- _analysis_cache.json +0 -0
- _perception_cache.json +1 -0
- app.py +205 -0
- data.xlsx +0 -0
- requirements.txt +113 -0
- z_scorer.pickle +3 -0
README.md
CHANGED
@@ -1,9 +1,10 @@
|
|
1 |
---
|
2 |
-
title: Lorentz
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
colorTo: yellow
|
6 |
sdk: streamlit
|
|
|
7 |
sdk_version: 1.33.0
|
8 |
app_file: app.py
|
9 |
pinned: false
|
|
|
1 |
---
|
2 |
+
title: Lorentz Wyl Plots
|
3 |
+
emoji: 🏢
|
4 |
+
colorFrom: green
|
5 |
colorTo: yellow
|
6 |
sdk: streamlit
|
7 |
+
python_version: 3.9
|
8 |
sdk_version: 1.33.0
|
9 |
app_file: app.py
|
10 |
pinned: false
|
_analysis_cache.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
_perception_cache.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"Actor Jonathan Majors was sentenced to probation but avoided prison time Monday for assaulting his ex-girlfriend in a high-profile case that derailed the once-promising star\u2019s career.": {"blame-assassin": 1.0587158203125, "blame-victim": -0.3131292164325714, "blame-object": -0.6382754445075989, "blame-concept": 0.7285327315330505, "blame-none": -1.1402558088302612, "cause-human": 0.6028897762298584, "cause-object": -0.43184733390808105, "cause-concept": 2.4198923110961914, "cause-none": -0.7864089012145996, "focus-assassin": 1.6552832126617432, "focus-victim": -0.555014967918396, "focus-object": -1.0255275964736938, "focus-concept": -0.19528286159038544}, "Both young men have denied the murder of Matt O'Neill (29) at Glenwood, Carrigaline, Co Cork on December 28 2022.": {"blame-assassin": 0.33367761969566345, "blame-victim": -0.8599993586540222, "blame-object": -0.5369545817375183, "blame-concept": -0.7368083596229553, "blame-none": -0.5305569171905518, "cause-human": 0.37174251675605774, "cause-object": -0.6019272804260254, "cause-concept": -0.6716463565826416, "cause-none": -0.35565000772476196, "focus-assassin": 0.33908843994140625, "focus-victim": -1.008745551109314, "focus-object": -1.0058650970458984, "focus-concept": -1.0604490041732788}, "Marvel had had cast him as Kang the Conqueror, a role envisioned as the main villain in the entertainment empire\u2019s movies and television shows that would likely have cemented his name as one of the biggest actors in Hollywood.": {"blame-assassin": -0.007908474653959274, "blame-victim": 0.30088818073272705, "blame-object": -0.46169552206993103, "blame-concept": 1.1651664972305298, "blame-none": 0.12646429240703583, "cause-human": -0.25561121106147766, "cause-object": -0.8028050065040588, "cause-concept": 0.7382392883300781, "cause-none": 0.32710254192352295, "focus-assassin": 0.5208323001861572, "focus-victim": -1.3330409526824951, "focus-object": -1.242337703704834, "focus-concept": 0.5124174952507019}, "Jonathan Majors sentenced to probation but no prison time for assaulting ex-girlfriend": {"blame-assassin": 1.1253145933151245, "blame-victim": -0.4928406774997711, "blame-object": -0.6389718055725098, "blame-concept": -0.7129324674606323, "blame-none": -1.1743110418319702, "cause-human": 0.7772271633148193, "cause-object": -0.4559487998485565, "cause-concept": 1.1864570379257202, "cause-none": -1.0161594152450562, "focus-assassin": 1.519632339477539, "focus-victim": -0.6940422058105469, "focus-object": -1.0661741495132446, "focus-concept": -0.8208003044128418}, "The conviction stems from an altercation in March 2023 in which Majors\u2019 then girlfriend, Grace Jabbari, accused him of attacking her in the backseat of a chauffeured car, saying he hit her head with his open hand, twisted her arm behind her back and squeezed her middle finger until it fractured.": {"blame-assassin": 1.0196936130523682, "blame-victim": -0.059602316468954086, "blame-object": 0.5360071063041687, "blame-concept": 0.6648409366607666, "blame-none": -0.9896826148033142, "cause-human": 0.7961333990097046, "cause-object": 1.921904444694519, "cause-concept": 1.6922309398651123, "cause-none": -0.9930609464645386, "focus-assassin": 1.4526116847991943, "focus-victim": 0.3506205379962921, "focus-object": 1.0014535188674927, "focus-concept": -0.44385918974876404}, "The 34-year-old star of Creed III and other films had faced up to a year behind bars after he was convicted of misdemeanor assault by a Manhattan jury in December.": {"blame-assassin": 0.705411434173584, "blame-victim": -0.2929202616214752, "blame-object": -0.6433072686195374, "blame-concept": 0.08167269080877304, "blame-none": -0.9961122274398804, "cause-human": 0.345691055059433, "cause-object": -0.4403137266635895, "cause-concept": 0.8255045413970947, "cause-none": -0.7092723250389099, "focus-assassin": 1.1860092878341675, "focus-victim": -1.1555392742156982, "focus-object": -0.9432039856910706, "focus-concept": -0.5159686207771301}, "Celebrity girlfriend assault: probation but no prison": {"blame-assassin": 0.7388437986373901, "blame-victim": -0.5797812342643738, "blame-object": -0.6848915219306946, "blame-concept": -0.3240378201007843, "blame-none": -0.8050418496131897, "cause-human": 0.5930691957473755, "cause-object": -0.6624751687049866, "cause-concept": -0.10581661015748978, "cause-none": -0.6925707459449768, "focus-assassin": 0.6616228222846985, "focus-victim": -0.3684512972831726, "focus-object": -1.0978842973709106, "focus-concept": -0.7147754430770874}, "A Central Criminal Court jury was told that the murder trial of Jordan Deasy (19) and Ricardo Hoey (21) could last for three weeks and involved up to 100 witnesses.": {"blame-assassin": 0.3463893234729767, "blame-victim": -0.5917549729347229, "blame-object": -0.5782091617584229, "blame-concept": -0.4459962546825409, "blame-none": -0.2919679582118988, "cause-human": 0.12854841351509094, "cause-object": -0.5664983987808228, "cause-concept": -0.578106164932251, "cause-none": -0.17604726552963257, "focus-assassin": -0.023613741621375084, "focus-victim": -0.8229711055755615, "focus-object": -0.8287124633789062, "focus-concept": -0.6162551045417786}, "Two men deny murder of Matt O'Neill (29) who died of blunt force trauma to the brain last Christmas": {"blame-assassin": 0.7327715158462524, "blame-victim": -0.7164932489395142, "blame-object": -0.3343062698841095, "blame-concept": 0.14743326604366302, "blame-none": -0.5875529646873474, "cause-human": 0.36747679114341736, "cause-object": -0.004294699523597956, "cause-concept": -0.3672190010547638, "cause-none": -0.1701023131608963, "focus-assassin": 0.20660096406936646, "focus-victim": -0.49508240818977356, "focus-object": 0.5558875203132629, "focus-concept": -0.2284395396709442}, "Following the guilty verdict, Majors had been immediately dropped by Marvel Studios.": {"blame-assassin": -1.154991626739502, "blame-victim": -0.4692208170890808, "blame-object": -0.5731103420257568, "blame-concept": 0.03241254761815071, "blame-none": 0.5954883694648743, "cause-human": -1.6818609237670898, "cause-object": -0.6681094765663147, "cause-concept": -0.357845664024353, "cause-none": 0.6048590540885925, "focus-assassin": -0.09218673408031464, "focus-victim": -1.4660536050796509, "focus-object": -0.8092613220214844, "focus-concept": -0.6244374513626099}, "TWO men have denied the murder of a young man who died from a blunt force trauma injury to the brain after allegedly being punched and kicked while on the ground.": {"blame-assassin": 0.652614951133728, "blame-victim": -0.0367235392332077, "blame-object": 0.36712631583213806, "blame-concept": -0.03773427754640579, "blame-none": -0.8281352519989014, "cause-human": 0.41021019220352173, "cause-object": 1.766466736793518, "cause-concept": -0.056652460247278214, "cause-none": -0.5149439573287964, "focus-assassin": 0.271369606256485, "focus-victim": -0.8555846810340881, "focus-object": 0.8768408894538879, "focus-concept": -0.5761364102363586}, "Woman killed stabbed in Rome by her husband, in front of 5 year-old daughter": {"blame-assassin": 0.9414207339286804, "blame-victim": -0.04461764544248581, "blame-object": -0.16482271254062653, "blame-concept": -0.22986283898353577, "blame-none": -0.849942684173584, "cause-human": 0.934583842754364, "cause-object": 1.7746551036834717, "cause-concept": 0.5504871010780334, "cause-none": -0.5968019962310791, "focus-assassin": 1.2021137475967407, "focus-victim": 0.8751474022865295, "focus-object": -0.5092344284057617, "focus-concept": -0.3483988344669342}, "Rome, woman killed with a knife while at home with her daughter.": {"blame-assassin": 0.7808877229690552, "blame-victim": 0.009837428107857704, "blame-object": 1.2229382991790771, "blame-concept": -0.566858172416687, "blame-none": -0.8533656597137451, "cause-human": 0.9746439456939697, "cause-object": 2.020934581756592, "cause-concept": -0.40845543146133423, "cause-none": -0.46003034710884094, "focus-assassin": 0.0863802507519722, "focus-victim": 0.4883636236190796, "focus-object": 0.834324061870575, "focus-concept": -1.0412451028823853}, "Woman (37) stabbed to death in Rome (Quadraro) - Killer is on the run.": {"blame-assassin": -0.4569215178489685, "blame-victim": -0.6486603617668152, "blame-object": -0.5266470313072205, "blame-concept": -0.83063805103302, "blame-none": -0.0017317311139777303, "cause-human": 0.09990344196557999, "cause-object": 0.5891866683959961, "cause-concept": -0.6563338041305542, "cause-none": 0.4607381522655487, "focus-assassin": -0.8373498320579529, "focus-victim": 0.6194373965263367, "focus-object": -0.6780818104743958, "focus-concept": -0.9741805195808411}, "Investigators are looking for her husband": {"blame-assassin": 0.3130354583263397, "blame-victim": 0.08120786398649216, "blame-object": -0.7940467596054077, "blame-concept": -0.7095835208892822, "blame-none": -0.5263972282409668, "cause-human": -0.20510731637477875, "cause-object": -0.8483189940452576, "cause-concept": 0.06119095906615257, "cause-none": -0.558377742767334, "focus-assassin": 1.0915627479553223, "focus-victim": -0.061299439519643784, "focus-object": -1.3980844020843506, "focus-concept": -0.8778265118598938}, "Her husband fled": {"blame-assassin": 0.5910015106201172, "blame-victim": -0.2364596575498581, "blame-object": -0.6732892394065857, "blame-concept": 0.12021439522504807, "blame-none": -0.7206517457962036, "cause-human": 0.5171935558319092, "cause-object": -0.9836393594741821, "cause-concept": -0.026876291260123253, "cause-none": -0.27852296829223633, "focus-assassin": 1.2437087297439575, "focus-victim": -0.3858606517314911, "focus-object": -1.3192404508590698, "focus-concept": -0.3378058969974518}, "Husband suspected of the murder and on the run": {"blame-assassin": 0.6938604116439819, "blame-victim": -0.6964428424835205, "blame-object": -0.658865213394165, "blame-concept": -0.8738318085670471, "blame-none": -0.8188537359237671, "cause-human": 0.9216960072517395, "cause-object": -0.660191535949707, "cause-concept": -0.4328387677669525, "cause-none": -0.9654232859611511, "focus-assassin": 1.5559240579605103, "focus-victim": -1.1947952508926392, "focus-object": -1.359391689300537, "focus-concept": -1.1284878253936768}, "Arrested a presumed stabber": {"blame-assassin": 1.2013026475906372, "blame-victim": -0.5586795210838318, "blame-object": -0.48018503189086914, "blame-concept": -0.6348382234573364, "blame-none": -0.6290674805641174, "cause-human": 0.6510030627250671, "cause-object": 0.16070152819156647, "cause-concept": -0.29721298813819885, "cause-none": -0.8075675964355469, "focus-assassin": 0.6177792549133301, "focus-victim": -1.131298303604126, "focus-object": -0.958595871925354, "focus-concept": -1.0372509956359863}, "Rome, 37 years old Chinese woman stabbed to death in her house.": {"blame-assassin": 0.8905196785926819, "blame-victim": 0.16307620704174042, "blame-object": -0.024034105241298676, "blame-concept": -0.854949414730072, "blame-none": -0.7393554449081421, "cause-human": 0.8461908102035522, "cause-object": 1.2278996706008911, "cause-concept": -0.6121801733970642, "cause-none": -0.3421420753002167, "focus-assassin": 0.14153017103672028, "focus-victim": 0.925262987613678, "focus-object": -0.784242570400238, "focus-concept": -1.2927125692367554}, "Women (37) stabbed to death - Husband arrested early this morning near Termini": {"blame-assassin": 0.770552933216095, "blame-victim": -0.6804270148277283, "blame-object": -0.47282084822654724, "blame-concept": -0.9015131592750549, "blame-none": -0.6519438624382019, "cause-human": 0.07686356455087662, "cause-object": 0.11454227566719055, "cause-concept": -0.5410143136978149, "cause-none": 0.2172219157218933, "focus-assassin": 0.5667039752006531, "focus-victim": 0.43604785203933716, "focus-object": -0.8152377009391785, "focus-concept": -0.9497510194778442}, "A 37-year old woman was killed in her home.": {"blame-assassin": -0.027271393686532974, "blame-victim": 0.2087237536907196, "blame-object": -0.0763682872056961, "blame-concept": -0.8409069776535034, "blame-none": -0.4044610857963562, "cause-human": 0.19632458686828613, "cause-object": 0.16465213894844055, "cause-concept": -0.7759333252906799, "cause-none": -0.09287964552640915, "focus-assassin": -1.0198421478271484, "focus-victim": 1.2693705558776855, "focus-object": -0.6550375819206238, "focus-concept": -1.2090789079666138}, "Woman (37) stabbed to death at home": {"blame-assassin": 0.36545413732528687, "blame-victim": 0.09655387699604034, "blame-object": -0.39496925473213196, "blame-concept": -0.6926103830337524, "blame-none": -0.5747238397598267, "cause-human": 0.5101052522659302, "cause-object": 0.929320216178894, "cause-concept": -0.7649155259132385, "cause-none": -0.18858519196510315, "focus-assassin": 0.269491046667099, "focus-victim": 0.6374775171279907, "focus-object": -0.5070778131484985, "focus-concept": -0.6841973662376404}, "Possible femicide in Rome: man in Quadraro suspected of killing wife, is still on the run": {"blame-assassin": 0.9679134488105774, "blame-victim": -0.7175531983375549, "blame-object": -0.6347202062606812, "blame-concept": -0.6688706278800964, "blame-none": -0.8310282826423645, "cause-human": 0.7465377449989319, "cause-object": -0.4763023853302002, "cause-concept": -0.19712959229946136, "cause-none": -0.27663156390190125, "focus-assassin": 1.244513750076294, "focus-victim": -0.7742286324501038, "focus-object": -1.0001789331436157, "focus-concept": -0.7828097343444824}, "Woman killed at home in Rome.": {"blame-assassin": -1.0552839040756226, "blame-victim": 0.0950123518705368, "blame-object": -0.5577629208564758, "blame-concept": -0.6083512306213379, "blame-none": 0.09691355377435684, "cause-human": -0.15394754707813263, "cause-object": -0.592447817325592, "cause-concept": -0.7774249315261841, "cause-none": 0.2790927588939667, "focus-assassin": -0.8573687672615051, "focus-victim": 0.4887336492538452, "focus-object": -1.0020835399627686, "focus-concept": -0.8112781047821045}, "Her husband fled away": {"blame-assassin": 0.5780179500579834, "blame-victim": -0.3313773274421692, "blame-object": -1.0853097438812256, "blame-concept": 0.18443402647972107, "blame-none": -0.7212775945663452, "cause-human": 0.4397861063480377, "cause-object": -0.9597904086112976, "cause-concept": -0.23234523832798004, "cause-none": -0.408664733171463, "focus-assassin": 1.3144389390945435, "focus-victim": 0.0519266352057457, "focus-object": -1.42607843875885, "focus-concept": -0.16038833558559418}, "Woman (37) stabbed to death by her husband during violent encounter with daughter (5) present": {"blame-assassin": 1.0323123931884766, "blame-victim": -0.3921220600605011, "blame-object": -0.2635694742202759, "blame-concept": -0.013800758868455887, "blame-none": -0.8927636742591858, "cause-human": 1.0187216997146606, "cause-object": 0.6986340880393982, "cause-concept": 1.3641103506088257, "cause-none": -1.1197527647018433, "focus-assassin": 1.270248532295227, "focus-victim": 0.5102940797805786, "focus-object": -0.9987089037895203, "focus-concept": -0.15936648845672607}, "[email protected]": {"blame-assassin": -1.166473150253296, "blame-victim": 0.29008927941322327, "blame-object": 0.03646771237254143, "blame-concept": -0.23391695320606232, "blame-none": 0.7347126007080078, "cause-human": -1.338990330696106, "cause-object": -0.797793984413147, "cause-concept": -0.3563119173049927, "cause-none": 0.41755303740501404, "focus-assassin": -1.3734102249145508, "focus-victim": 0.7437000274658203, "focus-object": -0.6207965016365051, "focus-concept": -0.27986839413642883}, "\u201cI heard noise and I went out\u201d, woman killed at home by husband in front of 5 year-old daughter": {"blame-assassin": 0.8311721086502075, "blame-victim": -0.365587055683136, "blame-object": -0.5063235759735107, "blame-concept": -0.37967753410339355, "blame-none": -0.734774649143219, "cause-human": 0.7985115647315979, "cause-object": 0.41083088517189026, "cause-concept": 0.23345865309238434, "cause-none": -0.6015173196792603, "focus-assassin": 1.2111471891403198, "focus-victim": 0.35327038168907166, "focus-object": -0.3949596881866455, "focus-concept": 0.07851916551589966}, "Rome, man kills his wife in front of her daughter": {"blame-assassin": 1.0678471326828003, "blame-victim": 0.46435603499412537, "blame-object": -0.4883180260658264, "blame-concept": 0.6248618960380554, "blame-none": -0.9096969366073608, "cause-human": 0.9243366122245789, "cause-object": 1.180570125579834, "cause-concept": 0.35057640075683594, "cause-none": -0.9592993259429932, "focus-assassin": 1.4434700012207031, "focus-victim": -0.0829484760761261, "focus-object": -0.5603404641151428, "focus-concept": -0.3099440038204193}, "A Chinese woman was stabbed": {"blame-assassin": 0.42227470874786377, "blame-victim": 0.01856442168354988, "blame-object": -0.5179956555366516, "blame-concept": -0.5743631720542908, "blame-none": -0.6466489434242249, "cause-human": 0.499616801738739, "cause-object": -0.5344555377960205, "cause-concept": -0.4607166051864624, "cause-none": -1.069350242614746, "focus-assassin": 0.06246824190020561, "focus-victim": 0.542850136756897, "focus-object": -1.1806315183639526, "focus-concept": -1.019120454788208}, "Woman (37) stabbed to death during violent encounter at her home in daughter's (5) presence": {"blame-assassin": 0.8594041466712952, "blame-victim": -0.15644486248493195, "blame-object": -0.18872271478176117, "blame-concept": 0.0001994954509427771, "blame-none": -0.7470949292182922, "cause-human": 0.9016416072845459, "cause-object": 1.1645530462265015, "cause-concept": 0.25150296092033386, "cause-none": -0.4538063704967499, "focus-assassin": 0.8513665795326233, "focus-victim": 0.5476085543632507, "focus-object": -0.5997648239135742, "focus-concept": -0.20891700685024261}, "Rome, woman stabbed to death.": {"blame-assassin": -0.3018602728843689, "blame-victim": -0.2695583701133728, "blame-object": -0.2336144596338272, "blame-concept": -0.5051388144493103, "blame-none": -0.4062345623970032, "cause-human": 0.5500781536102295, "cause-object": 0.17891550064086914, "cause-concept": -0.6636513471603394, "cause-none": 0.19353200495243073, "focus-assassin": -0.8377816081047058, "focus-victim": 0.6867185235023499, "focus-object": -0.774989664554596, "focus-concept": -1.159168004989624}, "Woman stabbed to death in her apartment in Rome: 5-year-old daughter was at home at the time of the murder": {"blame-assassin": 0.6168699264526367, "blame-victim": -0.34339314699172974, "blame-object": -0.33386266231536865, "blame-concept": -0.5473448038101196, "blame-none": -0.3805404603481293, "cause-human": 0.6903616786003113, "cause-object": 0.4429260194301605, "cause-concept": -0.4729562997817993, "cause-none": 0.19213669002056122, "focus-assassin": 0.33036065101623535, "focus-victim": 0.9887105822563171, "focus-object": -0.2719307541847229, "focus-concept": -0.38805216550827026}, "Her husband allegedly fled away": {"blame-assassin": 0.6443172097206116, "blame-victim": -0.3627105951309204, "blame-object": -0.7564693093299866, "blame-concept": -0.006104936357587576, "blame-none": -0.7524334192276001, "cause-human": 0.3175418972969055, "cause-object": -0.8873823285102844, "cause-concept": 0.03843802586197853, "cause-none": -0.7932431101799011, "focus-assassin": 1.3195663690567017, "focus-victim": -0.19011840224266052, "focus-object": -1.3430665731430054, "focus-concept": -0.33463671803474426}, "A woman was murdered in Rome while at home with her young daughter.": {"blame-assassin": 0.5292419791221619, "blame-victim": 0.30053019523620605, "blame-object": -0.47873494029045105, "blame-concept": -0.03568301349878311, "blame-none": -0.8023659586906433, "cause-human": 0.4285414516925812, "cause-object": -0.28161612153053284, "cause-concept": -0.4459243416786194, "cause-none": -0.24532149732112885, "focus-assassin": 0.0009708268917165697, "focus-victim": 0.6603499054908752, "focus-object": -0.8346922397613525, "focus-concept": -0.8646243810653687}, "37-year-old Chinese woman murdered in her apartment in Rome": {"blame-assassin": 0.6055805087089539, "blame-victim": 0.06709443032741547, "blame-object": -0.5177412033081055, "blame-concept": -1.0713242292404175, "blame-none": -0.6910431385040283, "cause-human": 0.7305833697319031, "cause-object": -0.5928172469139099, "cause-concept": -0.6728085875511169, "cause-none": -0.09410987049341202, "focus-assassin": 0.5365990400314331, "focus-victim": 0.6314513683319092, "focus-object": -0.8306517601013184, "focus-concept": -1.317374348640442}, " Rome, Quadraro neighborhood: the man suspected to have killed by stabbyng his wife has been arrested": {"blame-assassin": 1.1464053392410278, "blame-victim": -0.8487230539321899, "blame-object": -0.5031872987747192, "blame-concept": -0.9854881763458252, "blame-none": -1.0015164613723755, "cause-human": 0.6404304504394531, "cause-object": 0.6525788903236389, "cause-concept": 0.3891216814517975, "cause-none": -0.5856691002845764, "focus-assassin": 1.3725260496139526, "focus-victim": -0.8858908414840698, "focus-object": -0.8707230091094971, "focus-concept": -0.9021369814872742}, "Feminicide in Rome, 37 years old Chinese woman killed by her husband in front of their daughter": {"blame-assassin": 1.095502495765686, "blame-victim": 0.17503675818443298, "blame-object": -0.044317539781332016, "blame-concept": -0.4287221133708954, "blame-none": -0.865020751953125, "cause-human": 0.9826217293739319, "cause-object": 1.2248224020004272, "cause-concept": 1.0112755298614502, "cause-none": -0.7131656408309937, "focus-assassin": 1.23875892162323, "focus-victim": 0.7539979815483093, "focus-object": -0.8524953126907349, "focus-concept": -0.5713657736778259}, "Man arrested for the murder of his wife in Rome: he had tried to leave town by train": {"blame-assassin": 1.135469675064087, "blame-victim": -0.19103139638900757, "blame-object": -0.67251056432724, "blame-concept": 0.8284747004508972, "blame-none": -0.9276074171066284, "cause-human": 0.7143720388412476, "cause-object": -0.6459435224533081, "cause-concept": 0.11336245387792587, "cause-none": -0.7097887992858887, "focus-assassin": 1.6332504749298096, "focus-victim": -0.8967152237892151, "focus-object": -1.144219994544983, "focus-concept": -0.4852965772151947}, "Woman killed by knife in Rome in front of 5 year-old daughter, husband arrested near Termini": {"blame-assassin": 1.210086703300476, "blame-victim": -0.4205947816371918, "blame-object": -0.07141570001840591, "blame-concept": -0.6498039364814758, "blame-none": -0.8642691373825073, "cause-human": 0.9806528687477112, "cause-object": 1.6627763509750366, "cause-concept": -0.09134841710329056, "cause-none": -0.21236413717269897, "focus-assassin": 1.301456332206726, "focus-victim": 0.45072898268699646, "focus-object": -0.2399590164422989, "focus-concept": -0.7384433746337891}, "Police suspect her husband": {"blame-assassin": 0.7433895468711853, "blame-victim": -0.01116070058196783, "blame-object": -0.590674638748169, "blame-concept": 0.18765106797218323, "blame-none": -0.71401047706604, "cause-human": 0.859955906867981, "cause-object": -0.8314203023910522, "cause-concept": -0.27798670530319214, "cause-none": -0.8475050330162048, "focus-assassin": 1.132333755493164, "focus-victim": -0.3831474184989929, "focus-object": -1.2223182916641235, "focus-concept": -0.6002827286720276}, "Deadly stabbing in Rome: Husband suspected of the woman's murder captured by police in the night.": {"blame-assassin": 1.0606005191802979, "blame-victim": -0.6035714149475098, "blame-object": -0.5695691704750061, "blame-concept": -0.747788667678833, "blame-none": -0.7839972376823425, "cause-human": 0.582966685295105, "cause-object": -0.2659671902656555, "cause-concept": -0.24072328209877014, "cause-none": -0.650257408618927, "focus-assassin": 1.2722291946411133, "focus-victim": -0.17269612848758698, "focus-object": -0.9622184634208679, "focus-concept": -0.7823270559310913}, "5-year-old daughter was at home at the time of the murder": {"blame-assassin": 0.31321707367897034, "blame-victim": 0.16416886448860168, "blame-object": -0.562633216381073, "blame-concept": -0.5603742003440857, "blame-none": 0.10873997211456299, "cause-human": 0.03977982699871063, "cause-object": -0.7193130850791931, "cause-concept": -0.678102970123291, "cause-none": 0.5020983815193176, "focus-assassin": -0.2061898559331894, "focus-victim": 0.8690225481987, "focus-object": -0.9299608469009399, "focus-concept": -0.36368128657341003}, "37-year-old Chinese woman killed by her husband in Quadraro in Rome": {"blame-assassin": 1.1681866645812988, "blame-victim": -0.10509136319160461, "blame-object": -0.36027368903160095, "blame-concept": -0.9057487845420837, "blame-none": -0.8369616270065308, "cause-human": 1.0208083391189575, "cause-object": -0.23398731648921967, "cause-concept": -0.47762125730514526, "cause-none": -0.3417365849018097, "focus-assassin": 1.0568686723709106, "focus-victim": 0.7923961281776428, "focus-object": -0.996035099029541, "focus-concept": -1.044630765914917}, "Rome, \u00a0Quadraro neighborhood: man has killed by stabbyng his wife in front of her daughter": {"blame-assassin": 1.1209818124771118, "blame-victim": -0.6092586517333984, "blame-object": -0.3067381680011749, "blame-concept": 0.0329994335770607, "blame-none": -0.9061940312385559, "cause-human": 0.8907816410064697, "cause-object": 1.4377959966659546, "cause-concept": 0.6835750341415405, "cause-none": -0.30127087235450745, "focus-assassin": 1.21828293800354, "focus-victim": -0.17542457580566406, "focus-object": -0.25349903106689453, "focus-concept": -0.2647019922733307}, "Woman stabbed to death in her apartment in Rome: husband arrested as main suspect": {"blame-assassin": 0.8519105911254883, "blame-victim": -0.603164792060852, "blame-object": -0.48022058606147766, "blame-concept": -0.9043233394622803, "blame-none": -0.7373567819595337, "cause-human": 0.7756348848342896, "cause-object": 0.9297934174537659, "cause-concept": -0.4901181757450104, "cause-none": -0.23380117118358612, "focus-assassin": 1.2856756448745728, "focus-victim": 0.41388165950775146, "focus-object": -0.5277608036994934, "focus-concept": -0.8828336596488953}, "Woman stabbed to death in her apartment in Rome.": {"blame-assassin": -0.17137572169303894, "blame-victim": -0.09856727719306946, "blame-object": -0.30918335914611816, "blame-concept": -0.8322544097900391, "blame-none": -0.3458186984062195, "cause-human": 0.43855559825897217, "cause-object": 0.6536886692047119, "cause-concept": -0.7885363698005676, "cause-none": 0.42713072896003723, "focus-assassin": -0.8842265009880066, "focus-victim": 0.5901778340339661, "focus-object": -0.2264055460691452, "focus-concept": -1.198877215385437}, "Woman stabbed in front of her daughter in her home: police suspects husband who may have fled": {"blame-assassin": 0.9140993356704712, "blame-victim": -0.37020084261894226, "blame-object": -0.25818777084350586, "blame-concept": -0.5793402194976807, "blame-none": -0.7495940327644348, "cause-human": 0.9052426815032959, "cause-object": 1.364701747894287, "cause-concept": -0.2882826626300812, "cause-none": -0.34797054529190063, "focus-assassin": 1.0512475967407227, "focus-victim": 0.20583266019821167, "focus-object": -0.5884801745414734, "focus-concept": -0.609580934047699}, "Neighbours report the couple often had violent arguments.": {"blame-assassin": 0.4963725507259369, "blame-victim": 0.4017191231250763, "blame-object": -0.537781298160553, "blame-concept": 0.5284959077835083, "blame-none": -0.6674476861953735, "cause-human": -0.17814767360687256, "cause-object": -0.8406278491020203, "cause-concept": 2.245201826095581, "cause-none": -0.7049922347068787, "focus-assassin": 0.31835004687309265, "focus-victim": -1.3500115871429443, "focus-object": -1.1312764883041382, "focus-concept": 0.24410690367221832}, "Femicide in Quadraro neighborhood: 37-year-old Chinese woman killed by her husband in Rome.": {"blame-assassin": 1.115739345550537, "blame-victim": -0.31499698758125305, "blame-object": -0.3950735330581665, "blame-concept": -0.6587293148040771, "blame-none": -0.7427958846092224, "cause-human": 0.8986117839813232, "cause-object": -0.2895506024360657, "cause-concept": -0.12052091956138611, "cause-none": 0.1557629257440567, "focus-assassin": 0.6100788712501526, "focus-victim": 0.7510258555412292, "focus-object": -1.0242074728012085, "focus-concept": -0.9053597450256348}, "Woman killed with kichen knife at home by her husband in front of 5 year-old daughter, Neighbors: \u201cI heard screams and noise and I went out but was late\u201d": {"blame-assassin": 1.0075547695159912, "blame-victim": -0.05372137948870659, "blame-object": 0.0658036395907402, "blame-concept": -0.30438971519470215, "blame-none": -0.7492923736572266, "cause-human": 0.9500102996826172, "cause-object": 1.7948311567306519, "cause-concept": 0.4919205904006958, "cause-none": -0.47972387075424194, "focus-assassin": 1.139479398727417, "focus-victim": 0.4496069848537445, "focus-object": 0.5468625426292419, "focus-concept": 0.0026139116380363703}, "The man has been arrested.": {"blame-assassin": -0.5218260288238525, "blame-victim": -0.0022120829671621323, "blame-object": -0.6286571621894836, "blame-concept": -0.9169755578041077, "blame-none": -0.3315635323524475, "cause-human": -0.6013137698173523, "cause-object": -0.641227662563324, "cause-concept": -0.6188435554504395, "cause-none": -0.106288842856884, "focus-assassin": 0.4209803640842438, "focus-victim": -1.2630500793457031, "focus-object": -1.0392670631408691, "focus-concept": -1.1582252979278564}, "\"Domestic Disturbance Turns Deadly: 37-Year-Old Chinese Woman Fatally Stabbed in Rome Apartment\"": {"blame-assassin": 0.5017176866531372, "blame-victim": -0.6858696937561035, "blame-object": -0.6850004196166992, "blame-concept": -0.7159314155578613, "blame-none": -0.8203385472297668, "cause-human": 0.5090516805648804, "cause-object": -0.7145772576332092, "cause-concept": -0.382533997297287, "cause-none": -0.9373898506164551, "focus-assassin": 0.5311318039894104, "focus-victim": 0.5167638063430786, "focus-object": -1.1940513849258423, "focus-concept": -0.5895946621894836}, "Rome, woman (37) killed by husband - It is the 72th woman murdered since the beginning of the year.": {"blame-assassin": 0.011273751966655254, "blame-victim": -0.11306155472993851, "blame-object": -0.39436474442481995, "blame-concept": 0.22645418345928192, "blame-none": -0.10378039628267288, "cause-human": 0.3545607924461365, "cause-object": -0.40012675523757935, "cause-concept": -0.3672570288181305, "cause-none": -0.05002939701080322, "focus-assassin": -0.48500895500183105, "focus-victim": 0.9500935673713684, "focus-object": -1.1109843254089355, "focus-concept": 0.16112205386161804}, "Man arrested for killing wife with a knife.": {"blame-assassin": 1.4547874927520752, "blame-victim": -0.2872142791748047, "blame-object": 0.07471797615289688, "blame-concept": -0.7417699098587036, "blame-none": -0.9875862002372742, "cause-human": 0.8910753726959229, "cause-object": 1.823077917098999, "cause-concept": 0.28888726234436035, "cause-none": -1.1123675107955933, "focus-assassin": 1.3377970457077026, "focus-victim": -0.43445882201194763, "focus-object": 0.8066223859786987, "focus-concept": -0.9867531061172485}, "Their daughter was in the house at the time of the murder": {"blame-assassin": 0.1601179987192154, "blame-victim": 0.020375730469822884, "blame-object": -0.5628160834312439, "blame-concept": -0.45164111256599426, "blame-none": 0.5345203876495361, "cause-human": 0.16643713414669037, "cause-object": -0.830133855342865, "cause-concept": -0.5411543250083923, "cause-none": 0.3129540979862213, "focus-assassin": 0.605758011341095, "focus-victim": 0.2011004090309143, "focus-object": -0.8596230745315552, "focus-concept": -0.5403037667274475}, "Woman stabbed to death at home in Rome.": {"blame-assassin": -0.28496143221855164, "blame-victim": -0.2007453441619873, "blame-object": -0.4163666367530823, "blame-concept": -0.7028643488883972, "blame-none": -0.37580615282058716, "cause-human": 0.3553897738456726, "cause-object": 0.5769342184066772, "cause-concept": -0.7591997385025024, "cause-none": 0.09372154623270035, "focus-assassin": -0.7395526766777039, "focus-victim": 0.6880345344543457, "focus-object": -0.665503740310669, "focus-concept": -1.0037411451339722}, " Rome, the man suspected to have killed by stabbyng his wife has been arrested.": {"blame-assassin": 1.4207465648651123, "blame-victim": -0.7538151144981384, "blame-object": -0.5759817957878113, "blame-concept": -0.7528424263000488, "blame-none": -1.1613351106643677, "cause-human": 0.7919354438781738, "cause-object": 0.9452908039093018, "cause-concept": 0.7420710921287537, "cause-none": -0.887161135673523, "focus-assassin": 1.4464675188064575, "focus-victim": -0.7464419007301331, "focus-object": -0.8630331158638, "focus-concept": -1.0808298587799072}, "The police tracked him down in the city, not far from Termini station": {"blame-assassin": -0.7669796347618103, "blame-victim": -0.7456995844841003, "blame-object": -0.6762293577194214, "blame-concept": -0.7183098196983337, "blame-none": 0.14837713539600372, "cause-human": -1.0511802434921265, "cause-object": -0.7607147097587585, "cause-concept": -0.7777164578437805, "cause-none": 0.6737768054008484, "focus-assassin": -0.6399377584457397, "focus-victim": -1.692221999168396, "focus-object": -0.5611519813537598, "focus-concept": -1.3268382549285889}, "Husband suspected of the murder, captured by police.": {"blame-assassin": 0.5298698544502258, "blame-victim": -0.5045542120933533, "blame-object": -0.6283653378486633, "blame-concept": -1.0429762601852417, "blame-none": -0.6862391233444214, "cause-human": 0.44710832834243774, "cause-object": -0.5471621155738831, "cause-concept": -0.4079943001270294, "cause-none": -0.5421837568283081, "focus-assassin": 1.3259085416793823, "focus-victim": -0.9495715498924255, "focus-object": -1.1535791158676147, "focus-concept": -1.1601359844207764}, "He was trying to run: Police found him in Termini.": {"blame-assassin": -0.30198195576667786, "blame-victim": -0.4484192728996277, "blame-object": -0.5976856350898743, "blame-concept": -0.7389621138572693, "blame-none": -0.0685170441865921, "cause-human": -0.3498765826225281, "cause-object": -0.554252564907074, "cause-concept": -0.2848188877105713, "cause-none": 0.24764908850193024, "focus-assassin": -0.18795429170131683, "focus-victim": -1.0568809509277344, "focus-object": -0.4850521385669708, "focus-concept": -1.0912580490112305}, "Police suspect this is the 22nd femicide in 2024": {"blame-assassin": -0.19046738743782043, "blame-victim": -0.6513540744781494, "blame-object": -0.6664432287216187, "blame-concept": -0.18935656547546387, "blame-none": 0.6988108158111572, "cause-human": -1.4068764448165894, "cause-object": -0.6692467927932739, "cause-concept": -0.7542968988418579, "cause-none": 0.15705320239067078, "focus-assassin": -0.9518113732337952, "focus-victim": -1.0043327808380127, "focus-object": -0.8320531249046326, "focus-concept": -0.6143154501914978}, "Woman stabbed to death in her apartment in Rome: husband fled, but was arrested by the police as main suspect.": {"blame-assassin": 0.9872367978096008, "blame-victim": -0.5761092305183411, "blame-object": -0.5285102725028992, "blame-concept": -0.3746843636035919, "blame-none": -0.8491857647895813, "cause-human": 0.9427244663238525, "cause-object": 0.529333770275116, "cause-concept": -0.32251065969467163, "cause-none": -0.4287147521972656, "focus-assassin": 1.2491176128387451, "focus-victim": 0.33297237753868103, "focus-object": -0.8794705271720886, "focus-concept": -0.8418151140213013}, "5-year-old was on the scene": {"blame-assassin": -0.813148021697998, "blame-victim": -0.6269714832305908, "blame-object": -0.7274290323257446, "blame-concept": -1.105955958366394, "blame-none": 0.9442123174667358, "cause-human": -1.083264946937561, "cause-object": -0.6712073683738708, "cause-concept": -0.7760385274887085, "cause-none": 0.04488767683506012, "focus-assassin": -0.7018630504608154, "focus-victim": -0.9367055296897888, "focus-object": -1.0543866157531738, "focus-concept": -1.0233051776885986}, "Most recent femicide in a series of cruel murders: husband suspected of stabbing his wife": {"blame-assassin": 1.1887542009353638, "blame-victim": -0.2560048997402191, "blame-object": -0.42848825454711914, "blame-concept": 0.44952723383903503, "blame-none": -0.9653131365776062, "cause-human": 0.8780454397201538, "cause-object": -0.16029557585716248, "cause-concept": 0.9233302474021912, "cause-none": -0.6964871883392334, "focus-assassin": 1.1396361589431763, "focus-victim": -0.988328754901886, "focus-object": -0.9110500812530518, "focus-concept": 0.010130726732313633}, "Husband on the run after allegedly stabbing his wife (37) to death during violent during a violent encounter in presence of her daughter (aged 5).": {"blame-assassin": 1.3119944334030151, "blame-victim": -0.12486863881349564, "blame-object": -0.20140978693962097, "blame-concept": 0.5548765063285828, "blame-none": -1.003324031829834, "cause-human": 1.1124749183654785, "cause-object": 1.6724741458892822, "cause-concept": 1.82231867313385, "cause-none": -0.840076208114624, "focus-assassin": 1.3908740282058716, "focus-victim": -0.2963496744632721, "focus-object": -0.5223827362060547, "focus-concept": -0.2490832805633545}, "Police arrests the presumed stabber of the Chinese woman": {"blame-assassin": 0.6856967210769653, "blame-victim": -0.46265366673469543, "blame-object": -0.6912520527839661, "blame-concept": -0.9345846176147461, "blame-none": -0.7630172371864319, "cause-human": 0.5118412375450134, "cause-object": 0.5221049785614014, "cause-concept": -0.5387157201766968, "cause-none": -1.0139508247375488, "focus-assassin": 1.2949694395065308, "focus-victim": -0.07526131719350815, "focus-object": -1.1318672895431519, "focus-concept": -1.1803098917007446}, "A woman was stabbed to death in Rome, allegedly by her husband, who was arrested overnight.": {"blame-assassin": 1.2826963663101196, "blame-victim": -0.22086584568023682, "blame-object": -0.5315461158752441, "blame-concept": -0.08872859179973602, "blame-none": -1.0393104553222656, "cause-human": 0.7930456399917603, "cause-object": 0.7769235372543335, "cause-concept": 0.15801392495632172, "cause-none": -0.9012068510055542, "focus-assassin": 1.347446084022522, "focus-victim": 0.5657009482383728, "focus-object": -0.6690416932106018, "focus-concept": -0.9772631525993347}}
|
app.py
ADDED
@@ -0,0 +1,205 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import pandas as pd
|
3 |
+
import json
|
4 |
+
import nltk
|
5 |
+
|
6 |
+
import re
|
7 |
+
|
8 |
+
nltk.download("punkt")
|
9 |
+
|
10 |
+
with open("_perception_cache.json") as f:
|
11 |
+
s2s = json.load(f)
|
12 |
+
with open("_analysis_cache.json") as f:
|
13 |
+
s2f = json.load(f)
|
14 |
+
|
15 |
+
db = pd.read_excel("data.xlsx")
|
16 |
+
|
17 |
+
FRAMES_OF_INTEREST = ["Abusing", "Attack", "Hit_target", "Quarreling", "Use_firearm", "Death", "Dead_or_alive", "Experience_bodily_harm", "Cause_harm", "Killing", "Event", "Catastrophe", "Offenses"]
|
18 |
+
|
19 |
+
|
20 |
+
def get_frame_analysis(s):
|
21 |
+
frame_analysis = []
|
22 |
+
if s not in s2f:
|
23 |
+
return None
|
24 |
+
for fns in s2f[s]["sociofillmore"][0]["fn_structures"]:
|
25 |
+
# if True:
|
26 |
+
if fns["frame"] in FRAMES_OF_INTEREST:
|
27 |
+
analysis = {
|
28 |
+
"frame": fns["frame"],
|
29 |
+
"trigger": " ".join(fns["target"]["tokens_str"])
|
30 |
+
}
|
31 |
+
analysis.update({
|
32 |
+
rol[0]: " ".join(rol[1]["tokens_str"]) for rol in fns["roles"]
|
33 |
+
})
|
34 |
+
frame_analysis.append(analysis)
|
35 |
+
|
36 |
+
if len(frame_analysis) > 0:
|
37 |
+
return pd.DataFrame(frame_analysis)
|
38 |
+
else:
|
39 |
+
return None
|
40 |
+
|
41 |
+
def analyze_document(doc):
|
42 |
+
if not pd.isna(doc):
|
43 |
+
sentences = nltk.sent_tokenize(
|
44 |
+
doc,
|
45 |
+
language="english"
|
46 |
+
)
|
47 |
+
else:
|
48 |
+
sentences = []
|
49 |
+
|
50 |
+
perception_tables = []
|
51 |
+
frame_tables = []
|
52 |
+
for si, s in enumerate(sentences[:20]):
|
53 |
+
frame_analysis_df = get_frame_analysis(s)
|
54 |
+
frame_tables.append(frame_analysis_df)
|
55 |
+
perception_tables.append(s2s.get(s))
|
56 |
+
return sentences, perception_tables, frame_tables
|
57 |
+
|
58 |
+
|
59 |
+
st.write("# LorentzFillmore: WATCH YOUR LANGUAGE")
|
60 |
+
|
61 |
+
st.dataframe(db)
|
62 |
+
|
63 |
+
st.write("## Writing Exercises & Perception Scores")
|
64 |
+
|
65 |
+
text_columns = [col for col in db.columns if col.startswith("Writing exercise:")]
|
66 |
+
selected_column = st.selectbox(label="Writing exercise:", options=text_columns)
|
67 |
+
aggregate_sentences = st.checkbox(label="Aggregate over sentences?")
|
68 |
+
|
69 |
+
perception_rows = []
|
70 |
+
for _, row in db.iterrows():
|
71 |
+
sentences, perception_tables, frame_tables = analyze_document(row[selected_column])
|
72 |
+
# mean_blame_score = pd.DataFrame(perception_tables).mean()["blame-assassin"]
|
73 |
+
|
74 |
+
if aggregate_sentences:
|
75 |
+
perception_row = {
|
76 |
+
"writer": row["Email Address"],
|
77 |
+
"gender": row["I identify as ..."],
|
78 |
+
"language": row["What is your native language?"],
|
79 |
+
"background": row["What is your background?"],
|
80 |
+
"text": sentences
|
81 |
+
}
|
82 |
+
for k, v in pd.DataFrame(perception_tables).mean().to_dict().items():
|
83 |
+
perception_row[k] = v
|
84 |
+
perception_rows.append(perception_row)
|
85 |
+
else:
|
86 |
+
for s, pt, ft in zip(sentences, perception_tables, frame_tables):
|
87 |
+
perception_row = {
|
88 |
+
"writer": row["Email Address"],
|
89 |
+
"gender": row["I identify as ..."],
|
90 |
+
"language": row["What is your native language?"],
|
91 |
+
"background": row["What is your background?"],
|
92 |
+
"text": s
|
93 |
+
}
|
94 |
+
for k, v in pd.Series(pt).to_dict().items():
|
95 |
+
perception_row[k] = v
|
96 |
+
perception_rows.append(perception_row)
|
97 |
+
|
98 |
+
perception_df = pd.DataFrame(perception_rows)
|
99 |
+
|
100 |
+
dimension = st.selectbox(label="Which dimension of perception?", options=["blame", "cause", "focus"])
|
101 |
+
dim_cols = [col for col in perception_df.columns if col.startswith(dimension)]
|
102 |
+
dim_df = (
|
103 |
+
perception_df[["writer", "text"] + dim_cols]
|
104 |
+
.style.background_gradient(subset=dim_cols, axis=None, vmin=-2, vmax=2, cmap="YlGnBu")
|
105 |
+
|
106 |
+
)
|
107 |
+
st.dataframe(dim_df)
|
108 |
+
|
109 |
+
st.write("### Analysis by demographic attribute")
|
110 |
+
|
111 |
+
demo_attrib = st.selectbox("Select demographic attribute:", options=["writer", "gender", "language", "background"])
|
112 |
+
perc_attrib = st.selectbox("Select perception attribute", options=dim_cols)
|
113 |
+
st.plotly_chart(perception_df.groupby(demo_attrib).agg({perc_attrib: "mean"}).plot.bar(backend="plotly"))
|
114 |
+
|
115 |
+
|
116 |
+
st.write("## Comparing versions")
|
117 |
+
v_number = int(re.search(r"version (\d)", selected_column).group(1))
|
118 |
+
if v_number < 2:
|
119 |
+
st.warning("To compare versions, select a writing exercise with version number 2 or higher.")
|
120 |
+
else:
|
121 |
+
prev_version = re.sub(r"version (\d)", f"version {v_number - 1}", selected_column)
|
122 |
+
assert prev_version in text_columns
|
123 |
+
st.info(f"Comparing _{selected_column.replace('Writing exercise: ', '')}_ ↔️ _{prev_version.replace('Writing exercise: ', '')}_")
|
124 |
+
|
125 |
+
perception_diff_rows = []
|
126 |
+
for _, row in db.iterrows():
|
127 |
+
sentences, perception_tables, frame_tables = analyze_document(row[selected_column])
|
128 |
+
prev_sentences, prev_perception_tables, prev_frame_tables = analyze_document(row[prev_version])
|
129 |
+
|
130 |
+
perception_diff_row = {
|
131 |
+
"writer": row["Email Address"],
|
132 |
+
"gender": row["I identify as ..."],
|
133 |
+
"language": row["What is your native language?"],
|
134 |
+
"background": row["What is your background?"],
|
135 |
+
f"text_v{v_number - 1}": prev_sentences,
|
136 |
+
f"text_v{v_number}": sentences
|
137 |
+
}
|
138 |
+
perc_new = pd.DataFrame(perception_tables).mean().to_dict()
|
139 |
+
perc_old = pd.DataFrame(prev_perception_tables).mean().to_dict()
|
140 |
+
for k, v in perc_new.items():
|
141 |
+
if k not in perc_old:
|
142 |
+
perception_diff_row[k] = 0
|
143 |
+
else:
|
144 |
+
perception_diff_row[k] = v - perc_old[k]
|
145 |
+
perception_diff_rows.append(perception_diff_row)
|
146 |
+
|
147 |
+
perception_diff_df = pd.DataFrame(perception_diff_rows)
|
148 |
+
|
149 |
+
dim_diff_df = (
|
150 |
+
perception_diff_df[["writer", f"text_v{v_number - 1}", f"text_v{v_number}"] + dim_cols]
|
151 |
+
.style.background_gradient(subset=dim_cols, axis=None, vmin=-2, vmax=2, cmap="YlGnBu")
|
152 |
+
|
153 |
+
)
|
154 |
+
st.dataframe(dim_diff_df)
|
155 |
+
|
156 |
+
st.write("### Analysis by demographic attribute")
|
157 |
+
|
158 |
+
demo_attrib_diff = st.selectbox("Select demographic attribute for diff:", options=["writer", "gender", "language", "background"])
|
159 |
+
perc_attrib_diff = st.selectbox("Select perception attribute for diff", options=dim_cols)
|
160 |
+
st.plotly_chart(perception_diff_df.groupby(demo_attrib_diff).agg({perc_attrib_diff: "mean"}).plot.bar(backend="plotly"))
|
161 |
+
|
162 |
+
|
163 |
+
st.write("## Frame analysis")
|
164 |
+
only_sentences_with_relevant_frames = st.checkbox("Only analyze sentences containing relevant frames?")
|
165 |
+
|
166 |
+
selected_writer = st.selectbox(
|
167 |
+
label="Select a writer:",
|
168 |
+
options=sorted([f"{row['Email Address']}" for idx, row in db.iterrows()])
|
169 |
+
)
|
170 |
+
|
171 |
+
st.write("----")
|
172 |
+
|
173 |
+
writer_row = db[db["Email Address"] == selected_writer].iloc[0]
|
174 |
+
|
175 |
+
st.write("### Text information")
|
176 |
+
st.dataframe(writer_row)
|
177 |
+
|
178 |
+
sentences, perception_tables, frame_tables = analyze_document(writer_row[selected_column])
|
179 |
+
|
180 |
+
|
181 |
+
st.write("### Analysis of the entire document")
|
182 |
+
mean_perception = pd.DataFrame(perception_tables).mean().to_frame(name="mean perception")
|
183 |
+
st.dataframe(mean_perception.style.highlight_max(axis=0), width=500)
|
184 |
+
|
185 |
+
st.write("---")
|
186 |
+
st.write("### Analysis by sentence")
|
187 |
+
|
188 |
+
for si, s in enumerate(sentences[:20]):
|
189 |
+
frame_analysis_df = frame_tables[si]
|
190 |
+
if frame_analysis_df is None and only_sentences_with_relevant_frames:
|
191 |
+
continue
|
192 |
+
|
193 |
+
st.write(f"#### Sentence #{1+si:02}/{len(sentences[:20])}\n*{s}*")
|
194 |
+
if s not in s2s or s not in s2f:
|
195 |
+
st.write("(Analysis not found)")
|
196 |
+
continue
|
197 |
+
|
198 |
+
st.write("##### Perception")
|
199 |
+
perception_table = perception_tables[si]
|
200 |
+
perception_df = pd.Series(perception_table).to_frame(name="predicted perception").style.highlight_max(axis=0)
|
201 |
+
st.dataframe(perception_df, width=500)
|
202 |
+
|
203 |
+
if frame_analysis_df is not None:
|
204 |
+
st.write("##### Relevant frames")
|
205 |
+
st.dataframe(frame_analysis_df, width=750)
|
data.xlsx
ADDED
Binary file (13.3 kB). View file
|
|
requirements.txt
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
altair==5.3.0
|
2 |
+
asttokens==2.4.1
|
3 |
+
attrs==23.2.0
|
4 |
+
backcall==0.2.0
|
5 |
+
blinker==1.7.0
|
6 |
+
cachetools==5.3.3
|
7 |
+
captum==0.7.0
|
8 |
+
certifi==2024.2.2
|
9 |
+
charset-normalizer==3.3.2
|
10 |
+
click==8.1.7
|
11 |
+
comm==0.2.2
|
12 |
+
contourpy==1.2.1
|
13 |
+
cycler==0.12.1
|
14 |
+
debugpy==1.8.1
|
15 |
+
decorator==5.1.1
|
16 |
+
et-xmlfile==1.1.0
|
17 |
+
exceptiongroup==1.2.0
|
18 |
+
executing==2.0.1
|
19 |
+
filelock==3.13.3
|
20 |
+
fonttools==4.51.0
|
21 |
+
fsspec==2024.3.1
|
22 |
+
gitdb==4.0.11
|
23 |
+
GitPython==3.1.43
|
24 |
+
huggingface-hub==0.22.2
|
25 |
+
idna==3.6
|
26 |
+
importlib_metadata==7.1.0
|
27 |
+
importlib_resources==6.4.0
|
28 |
+
ipykernel==6.29.4
|
29 |
+
ipython==7.34.0
|
30 |
+
jedi==0.19.1
|
31 |
+
Jinja2==3.1.3
|
32 |
+
joblib==1.4.0
|
33 |
+
jsonschema==4.21.1
|
34 |
+
jsonschema-specifications==2023.12.1
|
35 |
+
jupyter_client==8.6.1
|
36 |
+
jupyter_core==5.7.2
|
37 |
+
kiwisolver==1.4.5
|
38 |
+
markdown-it-py==3.0.0
|
39 |
+
MarkupSafe==2.1.5
|
40 |
+
matplotlib==3.8.4
|
41 |
+
matplotlib-inline==0.1.6
|
42 |
+
mdurl==0.1.2
|
43 |
+
mpmath==1.3.0
|
44 |
+
nest-asyncio==1.6.0
|
45 |
+
networkx==3.2.1
|
46 |
+
nltk==3.8.1
|
47 |
+
numpy==1.26.4
|
48 |
+
nvidia-cublas-cu12==12.1.3.1
|
49 |
+
nvidia-cuda-cupti-cu12==12.1.105
|
50 |
+
nvidia-cuda-nvrtc-cu12==12.1.105
|
51 |
+
nvidia-cuda-runtime-cu12==12.1.105
|
52 |
+
nvidia-cudnn-cu12==8.9.2.26
|
53 |
+
nvidia-cufft-cu12==11.0.2.54
|
54 |
+
nvidia-curand-cu12==10.3.2.106
|
55 |
+
nvidia-cusolver-cu12==11.4.5.107
|
56 |
+
nvidia-cusparse-cu12==12.1.0.106
|
57 |
+
nvidia-nccl-cu12==2.19.3
|
58 |
+
nvidia-nvjitlink-cu12==12.4.127
|
59 |
+
nvidia-nvtx-cu12==12.1.105
|
60 |
+
openpyxl==3.1.2
|
61 |
+
packaging==24.0
|
62 |
+
pandas==2.2.1
|
63 |
+
parso==0.8.4
|
64 |
+
pexpect==4.9.0
|
65 |
+
pickleshare==0.7.5
|
66 |
+
pillow==10.3.0
|
67 |
+
platformdirs==4.2.0
|
68 |
+
plotly==5.20.0
|
69 |
+
prompt-toolkit==3.0.43
|
70 |
+
protobuf==4.25.3
|
71 |
+
psutil==5.9.8
|
72 |
+
ptyprocess==0.7.0
|
73 |
+
pure-eval==0.2.2
|
74 |
+
pyarrow==15.0.2
|
75 |
+
pydeck==0.8.1b0
|
76 |
+
Pygments==2.17.2
|
77 |
+
pyparsing==3.1.2
|
78 |
+
python-dateutil==2.9.0.post0
|
79 |
+
pytz==2024.1
|
80 |
+
PyYAML==6.0.1
|
81 |
+
pyzmq==25.1.2
|
82 |
+
referencing==0.34.0
|
83 |
+
regex==2023.12.25
|
84 |
+
requests==2.31.0
|
85 |
+
rich==13.7.1
|
86 |
+
rpds-py==0.18.0
|
87 |
+
sacremoses==0.1.1
|
88 |
+
safetensors==0.4.2
|
89 |
+
scikit-learn==1.0.2
|
90 |
+
scipy==1.13.0
|
91 |
+
six==1.16.0
|
92 |
+
smmap==5.0.1
|
93 |
+
stack-data==0.6.3
|
94 |
+
streamlit==1.33.0
|
95 |
+
sympy==1.12
|
96 |
+
tenacity==8.2.3
|
97 |
+
threadpoolctl==3.4.0
|
98 |
+
tokenizers==0.10.3
|
99 |
+
toml==0.10.2
|
100 |
+
toolz==0.12.1
|
101 |
+
torch==2.2.2
|
102 |
+
tornado==6.4
|
103 |
+
tqdm==4.66.2
|
104 |
+
traitlets==5.14.2
|
105 |
+
transformers==4.15.0
|
106 |
+
transformers-interpret==0.10.0
|
107 |
+
triton==2.2.0
|
108 |
+
typing_extensions==4.11.0
|
109 |
+
tzdata==2024.1
|
110 |
+
urllib3==2.2.1
|
111 |
+
watchdog==4.0.0
|
112 |
+
wcwidth==0.2.13
|
113 |
+
zipp==3.18.1
|
z_scorer.pickle
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e9d86c3866d76f5074982f901aa3fd93abbff7225d6c57cae92f737bd4d5cb02
|
3 |
+
size 761
|