Return the sentences that led to the construction of a specified edge.

    Args:
        G
        source: The source of the edge.
        target: The target of the edge.
2311
def _get_edge_sentences(
    G: AnalysisGraph, source: str, target: str
) -> List[str]:
    

    return chain.from_iterable(
        [
            [repr(e.text) for e in s.evidence]
            for s in G.edges[source, target]["InfluenceStatements"]
        ]
    )
157096
def edges(self, source=None, relation=None, target=None):
        
        edgematch = lambda e: (
            (source is None or source == e.source) and
            (relation is None or relation == e.relation) and
            (target is None or target == e.target)
        )
        variables = self.variables()
        edges = [t for t in self._triples if t.target in variables]
        return list(filter(edgematch, edges))
44632
def edges(word: str, lang: str = "th"):
    

    obj = requests.get(f"http://api.conceptnet.io/c/{lang}/{word}").json()
    return obj["edges"]
300036
def from_edges(edges, source_key='source', target_key='target', weight_key='weight', directed=True):
    
    raw = list(map(lambda x: [x[source_key], x[target_key], int(x[weight_key])], edges))
    g = IGraph.TupleList(raw, weights=True, directed=directed)
    g.vs['indegree'] = g.degree(mode="in")
    g.vs['outdegree'] = g.degree(mode="out")
    g.vs['label'] = g.vs['name']
    if 'group' not in g.vs.attributes():
        g.vs['group'] = labels_to_groups(g.vs['label'])
    return g
163280
def connect(self, source, target, witnesses):
        
        # print("Adding Edge: "+source+":"+target)
        if self.graph.has_edge(source, target):
            self.graph[source][target]["label"] += ", " + str(witnesses)
        else:
            self.graph.add_edge(source, target, label=witnesses)
1370626
static List<GoogleToken> getGoogleTokens(AnalyzedSentence sentence, boolean addStartToken, Tokenizer wordTokenizer) {
    List<GoogleToken> result = new ArrayList<>();
    if (addStartToken) {
      result.add(new GoogleToken(LanguageModel.GOOGLE_SENTENCE_START, 0, 0));
    }
    List<String> tokens = wordTokenizer.tokenize(sentence.getText());
    int startPos = 0;
    for (String token : tokens) {
      if (!StringTools.isWhitespace(token)) {
        int endPos = startPos + token.length();
        Set<AnalyzedToken> pos = findOriginalAnalyzedTokens(sentence, startPos, endPos);
        GoogleToken gToken = new GoogleToken(token, startPos, endPos, pos);
        result.add(gToken);
      }
      startPos += token.length();
    }
    return result;
  }
514925
def targetwords(self, index, targetwords, alignment):
        """"""
        return [ targetwords[x] for x in alignment[index] ]
576785
def insert_into_graph(self, graph):
        
        u = self.source.as_bel()
        v = self.target.as_bel()

        if self.evidence:
            return graph.add_qualified_edge(u, v, **json.loads(self.data))
        else:
            return graph.add_unqualified_edge(u, v, self.relation)
718071
def edge_by_target(self):
        """"""
        if self._edge_by_target is None:
            self._edge_by_target = reverse_edge_by_source_dict(self._edge_by_source_id,
                                                               self._nexson_tree['^ot:rootNodeId'])
        return self._edge_by_target
118956
def complete_definition(subj: Node,
                        source_graph: Graph,
                        target_graph: Optional[Graph]=None) -> PrettyGraph:
    
    if target_graph is None:
        target_graph = PrettyGraph()
    for p, o in source_graph.predicate_objects(subj):
        target_graph.add((subj, p, o))
        if isinstance(o, BNode):
            complete_definition(o, source_graph, target_graph)
    return target_graph
1330734
def _make_return_edges(self):
        

        for func_addr, func in self.functions.items():
            if func.returning is False:
                continue

            # get the node on CFG
            if func.startpoint is None:
                l.warning('Function %#x does not have a startpoint (yet).', func_addr)
                continue

            startpoint = self.model.get_any_node(func.startpoint.addr)
            if startpoint is None:
                # weird...
                l.warning('No CFGNode is found for function %#x in _make_return_edges().', func_addr)
                continue

            endpoints = self._get_return_sources(func)

            # get all callers
            callers = self.model.get_predecessors(startpoint, jumpkind='Ijk_Call')
            # for each caller, since they all end with a call instruction, get the immediate successor
            return_targets = itertools.chain.from_iterable(
                self.model.get_successors(caller, excluding_fakeret=False, jumpkind='Ijk_FakeRet') for caller in callers
            )
            return_targets = set(return_targets)

            for ep in endpoints:
                src = self.model.get_any_node(ep.addr)
                for rt in return_targets:
                    if not src.instruction_addrs:
                        ins_addr = None
                    else:
                        if self.project.arch.branch_delay_slot:
                            if len(src.instruction_addrs) > 1:
                                ins_addr = src.instruction_addrs[-2]
                            else:
                                l.error('At %s: expecting more than one instruction. Only got one.', src)
                                ins_addr = None
                        else:
                            ins_addr = src.instruction_addrs[-1]

                    self._graph_add_edge(rt, src, 'Ijk_Ret', ins_addr, DEFAULT_STATEMENT)
38027
def get_edge_annotation_layers(docgraph):
    
    all_layers = set()
    for source_id, target_id, edge_attribs in docgraph.edges_iter(data=True):
        for layer in edge_attribs['layers']:
            all_layers.add(layer)
    return all_layers
1118599
def p_for_sentence(p):
    
    p[0] = p[1]
    if is_null(p[0]):
        return
    p[1].appendChild(make_block(p[2], p[3]))
    gl.LOOPS.pop()
494180
def get_transcript_source_set(gtf):
    
    gene_to_source = get_gene_source_set(gtf)
    transcript_to_source = {}
    db = get_gtf_db(gtf)
    for feature in complete_features(db):
        gene_id = feature['gene_id'][0]
        transcript_to_source[feature['transcript_id'][0]] = gene_to_source[gene_id]
    return transcript_to_source
4184
def do_source(self, arg):
        
        try:
            obj = self._getval(arg)
        except Exception:
            return
        try:
            lines, lineno = getsourcelines(obj, self.get_locals(self.curframe))
        except (IOError, TypeError) as err:
            self.error(err)
            return
        self._print_lines(lines, lineno)
500589
def _construct_target_list(targets):
    
    target_entries = []
    for entry in targets:
        if not isinstance(entry, Gtk.TargetEntry):
            entry = Gtk.TargetEntry.new(*entry)
        target_entries.append(entry)
    return target_entries
746468
def euler_tour_dfs(G, source=None):
    
    if source is None:
        # produce edges for all components
        nodes = G
    else:
        # produce edges for components with source
        nodes = [source]
    yielder = []
    visited = set()
    for start in nodes:
        if start in visited:
            continue
        visited.add(start)
        stack = [(start, iter(G[start]))]
        while stack:
            parent, children = stack[-1]
            try:
                child = next(children)
                if child not in visited:
                    # yielder += [[parent, child]]
                    yielder += [parent]
                    visited.add(child)
                    stack.append((child, iter(G[child])))
            except StopIteration:
                if stack:
                    last = stack[-1]
                    yielder += [last[0]]
                stack.pop()
    return yielder