Skip to content

Commit e495f6f

Browse files
committed
corefud.Stats counts also the number of singletons
This number is not reported, but can be accessed from Python.
1 parent e0ddbf4 commit e495f6f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

udapi/block/corefud/stats.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ def __init__(self, m_len_max=5, c_len_max=5, report_mentions=True, report_entiti
2222
self.counter = Counter()
2323
self.mentions = 0
2424
self.entities = 0
25+
self.singletons = 0
2526
self.total_nodes = 0
2627
self.longest_mention = 0
2728
self.longest_entity = 0
@@ -32,6 +33,8 @@ def process_document(self, doc):
3233
self.total_nodes += len(list(doc.nodes))
3334
for entity in doc.coref_entities:
3435
len_mentions = len(entity.mentions)
36+
if len_mentions == 1:
37+
self.singletons += 1
3538
if len_mentions == 1 and self.exclude_singletons:
3639
continue
3740
elif len_mentions > 1 and self.exclude_nonsingletons:

0 commit comments

Comments
 (0)