Skip to content

Commit 495d271

Browse files
author
Daniel
committed
update scripts for class degrees and class instance degrees
1 parent 7c67e63 commit 495d271

21 files changed

+356886
-125
lines changed

NELL.ipynb

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@
668668
},
669669
{
670670
"cell_type": "code",
671-
"execution_count": 33,
671+
"execution_count": 1,
672672
"metadata": {
673673
"collapsed": true
674674
},
@@ -1874,6 +1874,63 @@
18741874
"print ('EXECUTION TIME: {} s'.format(end-start))\n"
18751875
]
18761876
},
1877+
{
1878+
"cell_type": "code",
1879+
"execution_count": 3,
1880+
"metadata": {
1881+
"collapsed": false
1882+
},
1883+
"outputs": [
1884+
{
1885+
"name": "stdout",
1886+
"output_type": "stream",
1887+
"text": [
1888+
"START\n"
1889+
]
1890+
}
1891+
],
1892+
"source": [
1893+
"# check concept:rtwcategory property\n",
1894+
"\n",
1895+
"nell = 'NELL/NELL.08m.995.esv.csv'\n",
1896+
"nellSample = 'NELL/NELL_sample.csv'\n",
1897+
"readFile = nellSample\n",
1898+
"\n",
1899+
"classInstanceDict = {}\n",
1900+
"\n",
1901+
"def getSPO(splittedLine):\n",
1902+
" word_position = 0\n",
1903+
" for word in splittedLine:\n",
1904+
" if (word_position == 0):\n",
1905+
" subj = word\n",
1906+
" elif (word_position == 1):\n",
1907+
" pred = word\n",
1908+
" elif (word_position == 2):\n",
1909+
" obj = word\n",
1910+
" else:\n",
1911+
" return subj, pred, obj\n",
1912+
" word_position += 1\n",
1913+
" return subj, pred, obj\n",
1914+
"print ('START')\n",
1915+
"fn = open(readFile, 'r')\n",
1916+
"for line in fn:\n",
1917+
" splitted_line = line.rstrip('\\n').split('\\t')\n",
1918+
" s, p, o = getSPO (splitted_line)\n",
1919+
" if (p==\"concept:rtwcategory\"):\n",
1920+
" if classInstanceDict.hasKey(s):\n",
1921+
" classInstanceDict[s] += 1\n",
1922+
" else:\n",
1923+
" classInstanceDict[s] = 1\n",
1924+
"fn.close()\n",
1925+
"\n",
1926+
"for k, v in classInstanceDict.values():\n",
1927+
" print ('{}: {}'.format(k,v))\n",
1928+
" \n",
1929+
" \n",
1930+
" \n",
1931+
" \n"
1932+
]
1933+
},
18771934
{
18781935
"cell_type": "code",
18791936
"execution_count": null,

NELL/NELL_ontology_sample.csv

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
Entity Relation Value
2+
concept:everypromotedthing humanformat {"%%s is %s", "something"}
3+
concept:everypromotedthing instancetype all
4+
concept:everypromotedthing memberofsets concept:rtwcategory
5+
concept:everypromotedthing populate false
6+
concept:everypromotedthing visible false
7+
concept:geolocatablething generalizations concept:everypromotedthing
8+
concept:geolocatablething humanformat {"%%s is a %s", "geolocatable thing"}
9+
concept:geolocatablething instancetype all
10+
concept:geolocatablething mutexpredicates concept:academicfield
11+
concept:geolocatablething mutexpredicates concept:awardtrophytournament
12+
concept:geolocatablething mutexpredicates concept:buildingmaterial
13+
concept:geolocatablething mutexpredicates concept:celltype
14+
concept:geolocatablething mutexpredicates concept:charactertrait
15+
concept:geolocatablething mutexpredicates concept:chemical
16+
concept:geolocatablething mutexpredicates concept:cognitiveactions
17+
concept:geolocatablething mutexpredicates concept:currency
18+
concept:geolocatablething mutexpredicates concept:date
19+
concept:geolocatablething mutexpredicates concept:economicsector
20+
concept:geolocatablething mutexpredicates concept:emotion
21+
concept:geolocatablething mutexpredicates concept:ethnicgroup
22+
concept:geolocatablething mutexpredicates concept:event
23+
concept:geolocatablething mutexpredicates concept:geometricshape
24+
concept:geolocatablething mutexpredicates concept:hobby
25+
concept:geolocatablething mutexpredicates concept:medicalprocedure
26+
concept:geolocatablething mutexpredicates concept:mlalgorithm
27+
concept:geolocatablething mutexpredicates concept:mlarea
28+
concept:geolocatablething mutexpredicates concept:mldataset
29+
concept:geolocatablething mutexpredicates concept:mlmetric
30+
concept:geolocatablething mutexpredicates concept:musicgenre
31+
concept:geolocatablething mutexpredicates concept:perceptionaction
32+
concept:geolocatablething mutexpredicates concept:perceptionevent
33+
concept:geolocatablething mutexpredicates concept:physicalaction
34+
concept:geolocatablething mutexpredicates concept:physicalcharacteristic
35+
concept:geolocatablething mutexpredicates concept:physicsterm
36+
concept:geolocatablething mutexpredicates concept:profession
37+
concept:geolocatablething mutexpredicates concept:protein
38+
concept:geolocatablething mutexpredicates concept:religion
39+
concept:geolocatablething mutexpredicates concept:sociopolitical
40+
concept:geolocatablething mutexpredicates concept:sport
41+
concept:geolocatablething mutexpredicates concept:visualartmovement
42+
concept:geolocatablething mutexpredicates concept:politicaloffice
43+
concept:geolocatablething mutexpredicates concept:color
44+
concept:geolocatablething mutexpredicates concept:language
45+
concept:geolocatablething mutexpredicates concept:species
46+
concept:geolocatablething mutexpredicates concept:programminglanguage
47+
concept:geolocatablething mutexpredicates concept:gamescore
48+
concept:geolocatablething mutexpredicates concept:nonneginteger
49+
concept:geolocatablething mutexpredicates concept:politicsissue
50+
concept:geolocatablething mutexpredicates concept:llcoordinate
51+
concept:geolocatablething mutexpredicates concept:recipe
52+
concept:geolocatablething mutexpredicates concept:game
53+
concept:geolocatablething mutexpredicates concept:researchproject
54+
concept:geolocatablething mutexpredicates concept:creativework
55+
concept:geolocatablething mutexpredicates concept:politicsbill
56+
concept:geolocatablething mutexpredicates concept:physiologicalcondition
57+
concept:geolocatablething mutexpredicates concept:sportsteamposition
58+
concept:geolocatablething mutexpredicates concept:animal
59+
concept:geolocatablething mutexpredicates concept:person
60+
concept:geolocatablething mutexpredicates concept:item
61+
concept:geolocatablething mutexpredicates concept:visualizableattribute
62+
concept:geolocatablething mutexpredicates concept:visualizableobject
63+
concept:geolocatablething mutexpredicates concept:scientificterm
64+
concept:geolocatablething mutexpredicates concept:time
65+
concept:geolocatablething mutexpredicates concept:victim
66+
concept:geolocatablething populate false
67+
concept:geolocatablething visible true
68+
concept:oilgasfield generalizations concept:geolocatablething
69+
concept:oilgasfield generalizations concept:visualizablescene
70+
concept:oilgasfield humanformat {"%%s is an %s", "oil or gas field"}
71+
concept:oilgasfield instancetype proper
72+
concept:oilgasfield mutexpredicates concept:city

0 commit comments

Comments
 (0)