parameters: (self, str)
return_statement: return [completions, completion_objects]
docstring: Find titles beginning with this string.
          Adds titles to self.completions, noting covered nodes in self.nodes_covered
          :param str: String of beginning characters
          :return:
docstring_summary: Find titles beginning with this string.
          Adds titles to self.completions, noting covered nodes in self.nodes_covered
          :param str: String of beginning characters
          :return:
docstring_tokens: Find titles beginning with this string . Adds titles to self . completions noting covered nodes in self . nodes_covered : param str : String of beginning characters : return :
function: def get_new_continuations_from_string(self, str):
          """
          Find titles beginning with this string.
          Adds titles to self.completions, noting covered nodes in self.nodes_covered
          :param str: String of beginning characters
          :return:
          """
  
          try:
              # skip = -1 if self.auto_completer.prefer_longest else 1
              all_continuations = self.auto_completer.title_trie.items(str)
              all_continuations.sort(key=lambda i: len(i[0]))
          except KeyError:
              return []
  
          # Use one title for each book before any duplicate match titles
          # Prefer primary titles
          # todo: don't list all subtree titles, if string doesn't cover base title
          completions = []
          completion_objects = []
          non_primary_matches = []
          for k, all_v in all_continuations:
              for v in all_v:
                  if v["is_primary"] and (v["type"], v["key"]) not in self.keys_covered:
                      if v["type"] == "ref" or v["type"] == "word_form" or v["type"] == "Topic":
                          completion_objects += [v]
                          completions += [v["title"]]
                      else:
                          completion_objects.insert(0, v)
                          completions.insert(0, v["title"])
                      self.keys_covered.add((v["type"], v["key"]))
                  else:
                      non_primary_matches += [(k, v)]
  
          # Iterate through non primary ones, until we cover the whole node-space
          for k, v in non_primary_matches:
              if (v["type"], v["key"]) not in self.keys_covered:
                  if v["type"] == "ref" and len(v["title"]) <= 4:  # The > 4 looks to get rid of "Gen" "Exod" and the like.
                      continue
                  completions += [v["title"]]
                  completion_objects += [v]
                  self.keys_covered.add((v["type"], v["key"]))
  
          return [completions, completion_objects]
function_tokens: def get_new_continuations_from_string ( self , str ) : try : # skip = -1 if self.auto_completer.prefer_longest else 1 all_continuations = self . auto_completer . title_trie . items ( str ) all_continuations . sort ( key = lambda i : len ( i [ 0 ] ) ) except KeyError : return [ ] # Use one title for each book before any duplicate match titles # Prefer primary titles # todo: don't list all subtree titles, if string doesn't cover base title completions = [ ] completion_objects = [ ] non_primary_matches = [ ] for k , all_v in all_continuations : for v in all_v : if v [ "is_primary" ] and ( v [ "type" ] , v [ "key" ] ) not in self . keys_covered : if v [ "type" ] == "ref" or v [ "type" ] == "word_form" or v [ "type" ] == "Topic" : completion_objects += [ v ] completions += [ v [ "title" ] ] else : completion_objects . insert ( 0 , v ) completions . insert ( 0 , v [ "title" ] ) self . keys_covered . add ( ( v [ "type" ] , v [ "key" ] ) ) else : non_primary_matches += [ ( k , v ) ] # Iterate through non primary ones, until we cover the whole node-space for k , v in non_primary_matches : if ( v [ "type" ] , v [ "key" ] ) not in self . keys_covered : if v [ "type" ] == "ref" and len ( v [ "title" ] ) <= 4 : # The > 4 looks to get rid of "Gen" "Exod" and the like. continue completions += [ v [ "title" ] ] completion_objects += [ v ] self . keys_covered . add ( ( v [ "type" ] , v [ "key" ] ) ) return [ completions , completion_objects ]