nodes: 0, module; 1, function_definition; 2, function_name:get_acronyms; 3, parameters; 4, block; 5, default_parameter; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, return_statement; 10, identifier:manuscript; 11, call; 12, comment:""" Find all the 2 and 3-letter acronyms in the manuscript and return as a sorted list of tuples """; 13, assignment; 14, pattern_list; 15, call; 16, block; 17, call; 18, attribute; 19, argument_list; 20, identifier:acronyms; 21, list; 22, identifier:f; 23, identifier:lines; 24, identifier:get_lines; 25, argument_list; 26, for_statement; 27, identifier:sorted; 28, argument_list; 29, attribute; 30, identifier:expanduser; 31, string; 32, identifier:manuscript; 33, identifier:line; 34, identifier:lines; 35, block; 36, call; 37, identifier:os; 38, identifier:path; 39, string_content:~/code/nlpia/lane/manuscript; 40, expression_statement; 41, if_statement; 42, attribute; 43, argument_list; 44, assignment; 45, identifier:matches; 46, block; 47, call; 48, identifier:items; 49, identifier:matches; 50, call; 51, for_statement; 52, identifier:dict; 53, argument_list; 54, attribute; 55, argument_list; 56, identifier:m; 57, identifier:matches; 58, block; 59, identifier:acronyms; 60, identifier:CRE_ACRONYM; 61, identifier:finditer; 62, identifier:line; 63, if_statement; 64, call; 65, block; 66, elif_clause; 67, elif_clause; 68, elif_clause; 69, attribute; 70, argument_list; 71, expression_statement; 72, call; 73, block; 74, call; 75, block; 76, call; 77, block; 78, identifier:m; 79, identifier:group; 80, string; 81, call; 82, attribute; 83, argument_list; 84, expression_statement; 85, attribute; 86, argument_list; 87, expression_statement; 88, attribute; 89, argument_list; 90, expression_statement; 91, string_content:a2; 92, attribute; 93, argument_list; 94, identifier:m; 95, identifier:group; 96, string; 97, call; 98, identifier:m; 99, identifier:group; 100, string; 101, call; 102, identifier:m; 103, identifier:group; 104, string; 105, call; 106, identifier:acronyms; 107, identifier:append; 108, tuple; 109, string_content:a3; 110, attribute; 111, argument_list; 112, string_content:a4; 113, attribute; 114, argument_list; 115, string_content:a5; 116, attribute; 117, argument_list; 118, call; 119, call; 120, identifier:acronyms; 121, identifier:append; 122, tuple; 123, identifier:acronyms; 124, identifier:append; 125, tuple; 126, identifier:acronyms; 127, identifier:append; 128, tuple; 129, attribute; 130, argument_list; 131, attribute; 132, argument_list; 133, call; 134, call; 135, call; 136, call; 137, call; 138, call; 139, identifier:m; 140, identifier:group; 141, string; 142, identifier:m; 143, identifier:group; 144, string; 145, attribute; 146, argument_list; 147, attribute; 148, argument_list; 149, attribute; 150, argument_list; 151, attribute; 152, argument_list; 153, attribute; 154, argument_list; 155, attribute; 156, argument_list; 157, string_content:a2; 158, string_content:s2; 159, identifier:m; 160, identifier:group; 161, string; 162, identifier:m; 163, identifier:group; 164, string; 165, identifier:m; 166, identifier:group; 167, string; 168, identifier:m; 169, identifier:group; 170, string; 171, identifier:m; 172, identifier:group; 173, string; 174, identifier:m; 175, identifier:group; 176, string; 177, string_content:a3; 178, string_content:s3; 179, string_content:a4; 180, string_content:s4; 181, string_content:a5; 182, string_content:s5
code: def get_acronyms(manuscript=os.path.expanduser('~/code/nlpia/lane/manuscript')):
      """ Find all the 2 and 3-letter acronyms in the manuscript and return as a sorted list of tuples """
      acronyms = []
      for f, lines in get_lines(manuscript):
          for line in lines:
              matches = CRE_ACRONYM.finditer(line)
              if matches:
                  for m in matches:
                      if m.group('a2'):
                          acronyms.append((m.group('a2'), m.group('s2')))
                      elif m.group('a3'):
                          acronyms.append((m.group('a3'), m.group('s3')))
                      elif m.group('a4'):
                          acronyms.append((m.group('a4'), m.group('s4')))
                      elif m.group('a5'):
                          acronyms.append((m.group('a5'), m.group('s5')))
  
      return sorted(dict(acronyms).items())