示例#1
0
def main():
	N2N_paths = []
	N2Npath = namedtuple('N2Npath', ['X', 'Y', 'is_linear'])

	sentences = p41.main()
	for sentence in sentences:
		noun_chunks = [(i, chunk) for i, chunk in enumerate(sentence) if chunk.include_pos('名詞')]
		if len(noun_chunks) > 1:
			for former, latter in combinations(noun_chunks, 2):
				# combinations don't cause error even if len(noun_chunks) < 2
				f_index = extract_path2root_index(former, sentence)
				l_index = extract_path2root_index(latter, sentence)
				f_i, l_i = list(zip(reversed(f_index), reversed(l_index)))[-1]
				linear_flg = (f_i == l_i)
				if linear_flg:
					f_index2 = f_index[:f_index.index(f_i)+1]
					l_index2 = l_index[:l_index.index(l_i)+1]
				else:
					f_index2 = f_index[:f_index.index(f_i)+2]
					l_index2 = l_index[:l_index.index(l_i)+2]

				X = [sentence[k] for k in f_index2]
				Y = [sentence[k] for k in l_index2]
				N2N_paths.append(N2Npath(X=X, Y=Y, is_linear=linear_flg))

	return N2N_paths
示例#2
0
def main():
    sentences = p41.main()
    verbcase_pats = []

    for sentence in sentences:
        verbcase_pats.append(exreact_verbcase_pat(sentence))

    return verbcase_pats
示例#3
0
def main():
    sentences = p41.main()
    verbcase_pats = []

    for sentence in sentences:
        verbcase_pats.append(exreact_verbcase_pat(sentence))

    return verbcase_pats
示例#4
0
def main():
    sentences = p41.main()

    new_sentences = []
    for sentence in sentences:
        paired_sentence = make_chunk_pair(sentence)
        new_sentences.append(paired_sentence)

    return new_sentences
示例#5
0
def main():
	sentences = p41.main()

	new_sentences = []
	for sentence in sentences:
		paired_sentence = make_chunk_pair(sentence)
		new_sentences.append(paired_sentence)

	return new_sentences
示例#6
0
def main():
	path2roots = []

	sentences = p41.main()
	for sentence in sentences:
		for chunk in sentence:
			if chunk.include_pos('名詞') and chunk.dst != -1:
				path2roots.append(extract_path2root(chunk, sentence))

	return path2roots
示例#7
0
def main():
    path2roots = []

    sentences = p41.main()
    for sentence in sentences:
        for chunk in sentence:
            if chunk.include_pos('名詞') and chunk.dst != -1:
                path2roots.append(extract_path2root(chunk, sentence))

    return path2roots