From 0377cb824aef0eec34861081ffb2696d0d7530a3 Mon Sep 17 00:00:00 2001 From: Philip Mueller Date: Thu, 9 Mar 2023 16:53:38 -0500 Subject: [PATCH] python 3.10 compat --- shifterator/helper.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/shifterator/helper.py b/shifterator/helper.py index c68730d..0df88fb 100755 --- a/shifterator/helper.py +++ b/shifterator/helper.py @@ -1,5 +1,9 @@ -import collections import pkgutil +try: + from collections.abc import Mapping +except ImportError: + from collections import Mapping + def preprocess_words_scores(type2freq_1, type2score_1, type2freq_2, type2score_2, @@ -153,7 +157,7 @@ def get_score_dictionary(scores): type2score: dict Keys are types and values are scores of those types """ - if isinstance(scores, collections.Mapping): + if isinstance(scores, Mapping): return scores.copy(), None # Else, load scores from predefined score file in shifterator