@@ -130,66 +130,4 @@ See code example below for running a full cross document coreference evaluation
130130Code Example
131131============
132132
133- .. code :: python
134-
135- # Configure which sieves you would like to run, the order, constrain and threshold,
136- event_config = EventConfig()
137-
138- event_config.sieves_order = [
139- (SieveType.STRICT , RelationType.SAME_HEAD_LEMMA , 0.0 ),
140- (SieveType.VERY_RELAX , RelationType.WIKIPEDIA_DISAMBIGUATION , 0.1 ),
141- (SieveType.VERY_RELAX , RelationType.WORD_EMBEDDING_MATCH , 0.7 ),
142- (SieveType.RELAX , RelationType.SAME_HEAD_LEMMA_RELAX , 0.5 ),
143- ]
144-
145- event_config.gold_mentions_file = ' <Replace with your event mentions json file>'
146-
147- entity_config = EntityConfig()
148-
149- entity_config.sieves_order = [
150- (SieveType.STRICT , RelationType.SAME_HEAD_LEMMA , 0.0 ),
151- (SieveType.VERY_RELAX , RelationType.WIKIPEDIA_REDIRECT_LINK , 0.1 ),
152- (SieveType.VERY_RELAX , RelationType.WIKIPEDIA_DISAMBIGUATION , 0.1 ),
153- (SieveType.VERY_RELAX , RelationType.WORD_EMBEDDING_MATCH , 0.7 ),
154- (SieveType.VERY_RELAX , RelationType.REFERENT_DICT , 0.5 )
155- ]
156-
157- entity_config.gold_mentions_file = ' <Replace with your entity mentions json file>'
158-
159- # CDCResources hold default attribute values that might need to be change,
160- # (using the defaults values in this example), use to configure attributes
161- # such as resources files location, output directory, resources init methods and other.
162- # check in class and see if any attributes require change in your set-up
163- resource_location = CDCResources()
164-
165- # create a new cross doc resources, with all needed semantic relation models
166- resources = CDCSettings(resource_location, event_config, entity_config)
167-
168- # run event evaluation
169- event_clusters = None
170- if event_config.run_evaluation:
171- # entry point for the event evaluation process
172- event_clusters = run_event_coref(resources)
173-
174- # run entity evaluation in the same way
175- entity_clusters = None
176- if entity_config.run_evaluation:
177- # entry point for the entity evaluation process
178- entity_clusters = run_entity_coref(resources)
179-
180- print (' -=Cross Document Coref Results=-' )
181- print (' -=Event Clusters Mentions=-' )
182- for event_cluster in event_clusters.clusters_list:
183- print (event_cluster.coref_chain)
184- for event_mention in event_cluster.mentions:
185- print (event_mention.mention_id)
186- print (event_mention.tokens_str)
187-
188- print (' -=Entity Clusters Mentions=-' )
189- for entity_cluster in entity_clusters.clusters_list:
190- print (entity_cluster.coref_chain)
191- for entity_mention in entity_cluster.mentions:
192- print (entity_mention.mention_id)
193- print (entity_mention.tokens_str)
194-
195- You can find the above example at this location: ``examples/cross_doc_coref/cross_doc_coref_sieves.py ``
133+ You can find code example for running the system at: ``examples/cross_doc_coref/cross_doc_coref_sieves.py ``
0 commit comments