Пример #1
0
 def print_dependencies(story):
     """Print user story dependencies to terminal"""
     print("---------- U S", story.number, "----------")
     for token in story.data:
         print(token.i, "-> ", token.text, " [", token.pos_, " (", token.tag_ ,")", "dep:", token.dep_, " at ", token.idx, "]")
         if token.is_stop:
             print("! PART OF STOP LIST")
         print("Left edge: ", token.left_edge)
         print("Right edge: ", token.right_edge)
         print("Children: ", get_tokens(token.children))
         print("Subtree: ", get_tokens(token.subtree))
         print("Head: ", token.head)
         if token is not story.data[0]:
             print("Left neighbor: ", token.nbor(-1))
         if token is not story.data[-1]:
             print("Right neighbor: ", token.nbor(1))
         print("Entity type: ", token.ent_type, "\n")
Пример #2
0
 def _print_free_form(story, part):
     """Print free form user story part to terminal"""
     p = 'story.' + part + '.'
     if eval(p + 'free_form'):
         print("  Free form:", get_tokens(eval(p + 'free_form')))
         if eval(p + 'verbs'):
             print("    Verbs:", get_tokens(eval(p + 'verbs')))
             if eval(p + 'phrasal_verbs'):
                 print("      Phrasal:", eval(p + 'phrasal_verbs'))
         if eval(p + 'noun_phrases'):
             print("    Noun phrases:", eval(p + 'noun_phrases'))
         if eval(p + 'compounds'):
             print("    Compound nouns:", eval(p + 'compounds'))
         if eval(p + 'nouns'):
             pnounstext = ""
             if eval(p + 'proper_nouns'):
                 pnounstext = " ( Proper: " + str(get_tokens(eval(p + 'proper_nouns'))) + ")"
             print("    Nouns:", get_tokens(eval(p + 'nouns')), pnounstext)
Пример #3
0
    def print_us_data(story):
        """Print user story data to terminal"""
        phrasetext = ""
        if story.means.main_verb.phrase:
            phrasetext = "( w/ Type " + story.means.main_verb.type + " phrase " + str(
                get_tokens(story.means.main_verb.phrase)) + " )"

        print("\n\n")
        Printer._print_subhead("BEGIN U S")
        print("User Story", story.number, ":", story.text)
        print(" >> INDICATORS\n  Role:", story.role.indicator, "\n    Means:",
              story.means.indicator, "\n    Ends:", story.ends.indicator)
        print(" >> ROLE\n  Functional role:",
              story.role.functional_role.main, "( w/ compound",
              get_tokens(story.role.functional_role.compound), ")")
        print(" >> MEANS\n  Main verb:", story.means.main_verb.main,
              phrasetext, "\n  Main object:",
              story.means.main_object.main, "( w/ noun phrase",
              get_tokens(story.means.main_object.phrase), "w/ compound",
              get_tokens(story.means.main_object.compound), ")")
        Printer._print_free_form(story, "means")
        Printer._print_free_form(story, "ends")

        Printer._print_subhead("END U S")