Skip to content

Instantly share code, notes, and snippets.

@Tarmean
Last active June 5, 2019 19:57
Show Gist options
  • Save Tarmean/41cb2e6d2c722fa74ea5bd3386df0534 to your computer and use it in GitHub Desktop.
Save Tarmean/41cb2e6d2c722fa74ea5bd3386df0534 to your computer and use it in GitHub Desktop.
WORD	PoS	PoSGold
Es	N	X
war	V	V
ein	X	X
klarer	X	X
,	X	X
kalter	X	X
Tag	N	N
Tag	N	X
im	X	X
April	N	N
April	N	X
,	X	X
und	X	X
die	X	X
Uhren	N	N
Uhren	N	X
schlugen	X	V
gerade	X	X
dreizehn	X	X
,	X	X
als	X	X
Winston	N	N
Winston	N	X
Smith	N	N
Smith	N	X
,	X	X
das	X	X
Kinn	N	N
Kinn	N	X
an	X	X
die	X	X
Brust	N	N
Brust	N	X
gepresst	V	V
,	X	X
um	X	X
dem	X	X
rauhen	X	X
Wind	N	N
Wind	N	X
zu	X	X
entgehen	V	V
,	X	X
rasch	X	X
durch	X	X
die	X	X
Glastüren	N	N
Glastüren	X	X
eines	X	X
der	X	X
Häuser	N	N
Häuser	N	X
des	X	X
Victory-Blocks	N	N
Victory-Blocks	N	X
schlüpfte	V	V
,	X	X
wenn	X	X
auch	X	X
nicht	X	X
rasch	X	X
genug	X	X
,	X	X
als	X	X
dass	X	X
nicht	X	X
zugleich	X	X
mit	X	X
ihm	X	X
ein	X	X
Wirbel	N	N
Wirbel	N	X
griesigen	X	X
Staubs	N	N
Staubs	N	X
eingedrungen	V	V
wäre	X	V
.	X	X


    N	V	X
N	13	0	0	13
V	0	5	2	7
X	13	0	45	58
    26	5	47	78



observed:		
=63/87
=0,724137931		

expected_n
=26/78*13/78
=0,055555556	

expected_v
=5/78*7/78
=0,005752794

expected_x	
=47/78*58/78
=0,448060487

expected   
=expected_n + expected_v + expected_x
=0,509368836                        

kappa				
=(observed-expected)/(1-expected)
=0,437740426				

Algorithm:

kappa alphabet data = (observedChance - expectedChance) / (1-expectedChance)
  where
    total = length data

    observedChance = length dataSame / total
    dataSame = filter (\(a,b) -> a == b) data

    expectedChance = sum [ chance_both_are x | x <- alphabet ] 
    chance_both_are x =  chanceAIsX * chanceBIsX
      where
        chanceAIsX = count x dataA / total
        chanceBIsX = count x dataB / total
    count x ls = length (filter (==x) ls)
    (dataA, dataB) = unzip data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment