def keyphrases_graph(keyphrases, texts, referral_confidence=0.6, relevance_threshold=0.25,
                     support_threshold=1, similarity_measure=None, synonimizer=None,
                     language=consts.Language.ENGLISH):

    similarity_measure = similarity_measure or relevance.ASTRelevanceMeasure()

    # Keyphrases table
    table = keyphrases_table(keyphrases, texts, similarity_measure, synonimizer, language)
    
    # Dictionary { "keyphrase" => set(names of texts containing "keyphrase") }
    keyphrase_texts = {keyphrase: set([text for text in texts
                                       if table[keyphrase][text] >= relevance_threshold])
                       for keyphrase in keyphrases}

    # Initializing the graph object with nodes
    graph = {
        "nodes": [
            {
                "id": i,
                "label": keyphrase,
                "support": len(keyphrase_texts[keyphrase])
            } for i, keyphrase in enumerate(keyphrases)
        ],
        "edges": [],
        "referral_confidence": referral_confidence,
        "relevance_threshold": relevance_threshold,
        "support_threshold": support_threshold
    }

    # Removing nodes with small support after we've numbered all nodes
    graph["nodes"] = [n for n in graph["nodes"]
                      if len(keyphrase_texts[n["label"]]) >= support_threshold]
    
    # Creating edges
    # NOTE(msdubov): permutations(), unlike combinations(), treats (1,2) and (2,1) as different
    for i1, i2 in itertools.permutations(range(len(graph["nodes"])), 2):
        node1 = graph["nodes"][i1]
        node2 = graph["nodes"][i2]
        confidence = (float(len(keyphrase_texts[node1["label"]] &
                                keyphrase_texts[node2["label"]])) /
                      max(len(keyphrase_texts[node1["label"]]), 1))
        if confidence >= referral_confidence:
            graph["edges"].append({
                "source": node1["id"],
                "target": node2["id"],
                "confidence": confidence
            })
            
    return graph
compute G+C content in intervals.
dataset/ETHPy150Open mikhaildubov/AST-text-analysis/east/applications.py/keyphrases_graph--crossover with--dataset/ETHPy150Open CGATOxford/cgat/scripts/gff2table.py/decorator_percent_gc