def test_aoa_none(): drop_caches() # Lemmas are all lowercase. for word in SubstitutionFeaturesMixin._aoa(): assert word.islower() # And it's properly computed. drop_caches() with settings.file_override("AOA"): with open(settings.AOA, "w") as f: f.write("Word,Rating.Mean\nhave,2\ntell,3") assert set(SubstitutionFeaturesMixin._aoa()) == {"have", "tell"}
def test_aoa(): drop_caches() assert SubstitutionFeaturesMixin._aoa("time") == 5.16 assert SubstitutionFeaturesMixin._aoa("vocative") == 14.27 assert np.isnan(SubstitutionFeaturesMixin._aoa("wickiup"))