Exemplo n.º 1
0
def main():

    cabocha_file = open(sys.argv[1], "r")
    all_sentences = takayuki.make_chunks(cabocha_file)
    cabocha_file.close()

    for chunks in all_sentences:
        for chunk in chunks:
            particles = list()
            phrases = list()
            if chunk.check_pos1("サ変接続") and chunk.check_base("を") and \
               chunks[chunk.dst].check_pos("動詞") and chunk.dst != -1:
                for departure in chunks[
                        chunk.dst].srcs[:len(chunks[chunk.dst].srcs) - 1]:
                    if chunks[departure].check_pos("助詞"):
                        particles.append(
                            chunks[departure].get_base_havingpos("助詞"))
                        phrases.append(chunks[departure].get_phrase())
                if particles and phrases:
                    print chunk.get_phrase()\
                          +chunks[chunk.dst].get_base_havingpos("動詞")\
                          + "\t"+" ".join(particles)\
                          + "\t" + " ".join(phrases)
                    particles = list()
                    phrases = list()
Exemplo n.º 2
0
def main():

    cabocha_file = open(sys.argv[1], "r")
    all_sentences = takayuki.make_chunks(cabocha_file)
    cabocha_file.close()

    for chunks in all_sentences:
        for chunk in chunks:
            if chunk.check_pos("名詞") and chunks[chunk.dst].check_pos("動詞"):
               print chunk.get_phrase() + "\t" + chunks[chunk.dst].get_phrase()
Exemplo n.º 3
0
def main():

    cabocha_file = open(sys.argv[1], "r")
    all_sentences = takayuki.make_chunks(cabocha_file)
    cabocha_file.close()

    for chunks in all_sentences:
        for chunk in chunks:
            print chunk.get_phrase() + "\t" + \
                  chunks[chunk.dst].get_phrase()
Exemplo n.º 4
0
def main():
    
    cabocha_file  = open(sys.argv[1], "r")
    all_sentences = takayuki.make_chunks(cabocha_file)
    cabocha_file.close()

    for chunks in all_sentences:
        for chunk in chunks:
            print chunk.get_phrase() + "\t" + \
                  chunks[chunk.dst].get_phrase()
Exemplo n.º 5
0
def main():

    cabocha_file = open(sys.argv[1], "r")
    all_sentences = takayuki.make_chunks(cabocha_file)
    cabocha_file.close()

    for chunks in all_sentences:
        for chunk in chunks:
            if chunk.check_pos("名詞") and chunks[chunk.dst].check_pos("動詞"):
                print chunk.get_phrase() + "\t" + chunks[
                    chunk.dst].get_phrase()
Exemplo n.º 6
0
def main():
    
    cabocha_file = open(sys.argv[1], "r")
    all_sentences = takayuki.make_chunks(cabocha_file)
    cabocha_file.close()

    particles = list()

    for chunks in all_sentences:
        for chunk in chunks:
            if chunk.check_pos("動詞") and chunk.srcs:
               particles = list()
               for departure in chunk.srcs:
                   if chunks[departure].check_pos("助詞"):
                      particles.append(chunks[departure].get_base_havingpos("助詞"))
               print chunk.get_phrase() + "\t" + " ".join(particles)
Exemplo n.º 7
0
def main():

    cabocha_file = open(sys.argv[1], "r")
    all_sentences = takayuki.make_chunks(cabocha_file)
    cabocha_file.close()

    for chunks in all_sentences:
        for chunk in chunks:
            phrases = list()
            if chunk.check_pos("名詞"):
               phrases.append(chunk.get_phrase())
               dst = chunk.dst
               while dst != -1:
                 phrases.append(chunks[dst].get_phrase())
                 dst = chunks[dst].dst
            if len(phrases) >= 2:
               print "->".join(phrases)