#average map consumption_var = np.sum(np.diff(consumption, axis = 1),axis = 1) consumption_var = ma.masked_where(isnan(consumption_var) == 1, consumption_var) consumption_ref = np.mean(consumption, axis = 1) consumption_ref = ma.masked_where(isnan(consumption_ref) == 1, consumption_ref) consumption_change = consumption_var / consumption_ref np.average(consumption_change, weights = weights) np.average(consumption_change[mask==0], weights = weights[mask==0]) map_consumption = module.make_map(consumption_change, filter_array, idlist, spatial_unit) module.new_map_netcdf(Input.outputDir + '/'+ 'map_consumption_change_1960to2010', map_consumption, 'consumption_change', '%', latitude, longitude) plt.imshow(map_consumption) plt.hist(consumption_change) np.max(consumption_change) np.min(consumption_change)
""" 33. サ変名詞 サ変接続の名詞をすべて抽出せよ. """ from module import make_map lines = make_map() st = set() for line in lines: for data in line: if data["pos"] == "名詞" and data["pos1"] == "サ変接続": st.add(data["base"]) print(st)
""" 34. 「AのB」 2つの名詞が「の」で連結されている名詞句を抽出せよ. """ from module import make_map lines = make_map() st = set() for line in make_map(): for i in range(len(line)): if line[i]["surface"] == "の": if i == 0 or i == len(line) - 1: continue if line[i - 1]["pos"] == "名詞" and line[i + 1]["pos"] == "名詞": st.add(line[i - 1]["surface"] + line[i]["surface"] + line[i + 1]["surface"]) print(st)