@@ -52,75 +52,93 @@ class KGWikiMedia (KnowledgeGraph): # pylint: disable=R0902,R0903
5252 NER_MAP : typing .Dict [ str , dict ] = OrderedDict ({
5353 "CARDINAL" : {
5454 "iri" : "http://dbpedia.org/resource/Cardinal_number" ,
55- "definition" : "Numerals that do not fall under another type"
55+ "definition" : "Numerals that do not fall under another type" ,
56+ "label" : "cardinal number" ,
5657 },
5758 "DATE" : {
5859 "iri" : "http://dbpedia.org/ontology/date" ,
59- "definition" : "Absolute or relative dates or periods"
60+ "definition" : "Absolute or relative dates or periods" ,
61+ "label" : "date" ,
6062 },
6163 "EVENT" : {
6264 "iri" : "http://dbpedia.org/ontology/Event" ,
63- "definition" : "Named hurricanes, battles, wars, sports events, etc."
65+ "definition" : "Named hurricanes, battles, wars, sports events, etc." ,
66+ "label" : "event" ,
6467 },
6568 "FAC" : {
6669 "iri" : "http://dbpedia.org/ontology/Infrastructure" ,
67- "definition" : "Buildings, airports, highways, bridges, etc."
70+ "definition" : "Buildings, airports, highways, bridges, etc." ,
71+ "label" : "infrastructure" ,
6872 },
6973 "GPE" : {
7074 "iri" : "http://dbpedia.org/ontology/Country" ,
71- "definition" : "Countries, cities, states"
75+ "definition" : "Countries, cities, states" ,
76+ "label" : "country" ,
7277 },
7378 "LANGUAGE" : {
7479 "iri" : "http://dbpedia.org/ontology/Language" ,
75- "definition" : "Any named language"
80+ "definition" : "Any named language" ,
81+ "label" : "language" ,
7682 },
7783 "LAW" : {
7884 "iri" : "http://dbpedia.org/ontology/Law" ,
79- "definition" : "Named documents made into laws "
85+ "definition" : "Named documents made into laws" ,
86+ "label" : "law" ,
8087 },
8188 "LOC" : {
8289 "iri" : "http://dbpedia.org/ontology/Place" ,
83- "definition" : "Non-GPE locations, mountain ranges, bodies of water"
90+ "definition" : "Non-GPE locations, mountain ranges, bodies of water" ,
91+ "label" : "place" ,
8492 },
8593 "MONEY" : {
8694 "iri" : "http://dbpedia.org/resource/Money" ,
87- "definition" : "Monetary values, including unit"
95+ "definition" : "Monetary values, including unit" ,
96+ "label" : "money" ,
8897 },
8998 "NORP" : {
9099 "iri" : "http://dbpedia.org/ontology/nationality" ,
91- "definition" : "Nationalities or religious or political groups"
100+ "definition" : "Nationalities or religious or political groups" ,
101+ "label" : "nationality" ,
92102 },
93103 "ORDINAL" : {
94104 "iri" : "http://dbpedia.org/resource/Ordinal_number" ,
95- "definition" : "Ordinal number, i.e., first, second, etc."
105+ "definition" : "Ordinal number, i.e., first, second, etc." ,
106+ "label" : "ordinal number" ,
96107 },
97108 "ORG" : {
98109 "iri" : "http://dbpedia.org/ontology/Organisation" ,
99- "definition" : "Companies, agencies, institutions, etc."
110+ "definition" : "Companies, agencies, institutions, etc." ,
111+ "label" : "organization" ,
100112 },
101113 "PERCENT" : {
102114 "iri" : "http://dbpedia.org/resource/Percentage" ,
103- "definition" : "Percentage"
115+ "definition" : "Percentage" ,
116+ "label" : "percentage" ,
104117 },
105118 "PERSON" : {
106119 "iri" : "http://dbpedia.org/ontology/Person" ,
107- "definition" : "People, including fictional"
120+ "definition" : "People, including fictional" ,
121+ "label" : "person" ,
108122 },
109123 "PRODUCT" : {
110124 "iri" : "http://dbpedia.org/ontology/product" ,
111- "definition" : "Vehicles, weapons, foods, etc. (Not services)"
125+ "definition" : "Vehicles, weapons, foods, etc. (Not services)" ,
126+ "label" : "product" ,
112127 },
113128 "QUANTITY" : {
114129 "iri" : "http://dbpedia.org/resource/Quantity" ,
115- "definition" : "Measurements, as of weight or distance"
130+ "definition" : "Measurements, as of weight or distance" ,
131+ "label" : "quantity" ,
116132 },
117133 "TIME" : {
118134 "iri" : "http://dbpedia.org/ontology/time" ,
119- "definition" : "Times smaller than a day"
135+ "definition" : "Times smaller than a day" ,
136+ "label" : "time" ,
120137 },
121138 "WORK OF ART" : {
122139 "iri" : "http://dbpedia.org/resource/Work_of_art" ,
123- "definition" : "Titles of books, songs, etc."
140+ "definition" : "Titles of books, songs, etc." ,
141+ "label" : "work of art" ,
124142 },
125143 })
126144
@@ -252,7 +270,7 @@ def normalize_prefix (
252270 debug : bool = False ,
253271 ) -> str :
254272 """
255- Normalize the given IRI to use the standard DBPedia namespace prefixes.
273+ Normalize the given IRI using the standard DBPedia namespace prefixes.
256274
257275 iri:
258276input IRI, in fully-qualified domain representation
@@ -1003,7 +1021,7 @@ def _make_link (
10031021 rel ,
10041022 NodeEnum .IRI ,
10051023 span = link .span ,
1006- label = link .iri ,
1024+ label = link .kg_ent . label , # type: ignore
10071025 length = link .length ,
10081026 count = 1 ,
10091027 )
0 commit comments