def replace_noun_morph_from_chunk_with(chunk, what): temp_morphs = chunk.morphs() new_morphs = list(map(lambda x: Morph(what, what, x.pos(), x.pos1()) if NLP43.is_noun(x) else copy.deepcopy(x), temp_morphs)) for m in chunk.morphs(): pass new_chunk = Chunk(new_morphs, chunk.dst()) for s in chunk.srcs(): new_chunk.append_srcs(s) return new_chunk
def is_noun_connected_sa(m): return NLP43.is_noun(m) and m.pos1().startswith('サ変接続')