diff --git a/GEODE/ENE/Detector.py b/GEODE/ENE/Detector.py index 5e31d671360f276aaf94afd8169a4d26446a52a3..02ac4dfc4af7f45895e99df42a0b2e0fdbe5ff60 100644 --- a/GEODE/ENE/Detector.py +++ b/GEODE/ENE/Detector.py @@ -23,3 +23,10 @@ def detector(model, corpus): for paragraph in paragraphs: eventsOfAnnotation(currentPosition, common, model(paragraph)) currentPosition += len(paragraph) + +def byArticle(measures): + measures['count'] = 1 + counts = measures.groupby(articleKey + ['event']).count().reset_index() + return counts.pivot(articleKey, + columns='event', + values='count').fillna(0).astype(int).reset_index()