示例#1
0
def render_regular_automaton(G):
    """
    Shows regular automaton for Grammar G
    """
    st.title('Autómata Regular')
    if not gp.is_regular(G):
        st.error('La gramática definida no es regular.')
        return

    dfa = gp.grammar_to_dfa(G)
    extended = NFA.extend_automaton(dfa)

    st.subheader('Autómata finito determinista obtenido de la gramática:')
    st.graphviz_chart(str(dfa.graph()))

    st.subheader('Autómata extendido para hallar la expresión regular:')
    st.graphviz_chart(str(extended.graph()))

    regex = extended.get_regex()

    st.subheader('Expresión regular:')
    st.text('{}'.format(regex))

    txt = st.text_input('Verificar expresión regular:')

    if st.button('Verificar'):
        match = re.fullmatch(regex, txt)
        if not match or match.end() != len(txt):
            st.error('La cadena no pertenece al lenguaje.')
        else:
            st.success('OK')
示例#2
0
def render_parser(G, algorithm: str, parser, is_ll1=False):
    """
    Render Parser Subsection
    """
    st.title('Parsear Cadena')
    w = st.text_input("Inserte la cadena a parsear")

    if st.button("comenzar"):
        st.subheader(f'Aplicando: {algorithm}')

        tokens = tokenize(G, w)

        if isinstance(tokens, list):
            productions = parser(tokens)
            if not productions:
                st.error("Error en parsing.\
                    La cadena no pertenece al lenguaje.")
            else:
                st.success("OK")
                if is_ll1:
                    tree = LLDerivationTree(productions)
                else:
                    tree = LRDerivationTree(productions)
                st.graphviz_chart(str(tree.graph()))
        else:
            st.error("Error en tokenize: " + tokens)
def show_topic_co_occurrences(corpus, number_of_topics, number_of_chunks=100):
	st.header("Topic co-occurrences")
	if corpus is None:
		st.markdown("Please upload a corpus first")
	else:
		with st.expander("Help"):
			st.markdown('''
				We consider topics to co-occur in the same document if the weight of both 
				topics for that document are greater than *minimum weight*. The thickness of
				an edge in the co-occurrance graph indicates how often two topics co-occur
				in a document (at least *minimum edges* times). Each node represents a 
				topic. Node size reflects the total weight of the topic.
			''')
		min_weight = st.sidebar.slider("Minimum weight", 0.0, 0.5, value=0.1, step=0.05)
		min_edges = st.sidebar.slider("Minimum number of edges", 1, 10, value=1)
		graph_container = st.empty()
		with st.expander("Settings"):
			library_to_use = st.radio("Visualization library to use", ("VisJS", "GraphViz"), index=0)
			if library_to_use == "VisJS":
				smooth_edges = st.checkbox("Draw with smooth edges", value=False)
		if library_to_use == "VisJS":
			graph_pyvis = topic_coocurrence_graph_pyvis(topic_model(corpus, number_of_topics, number_of_chunks), 
				corpus, number_of_topics, min_weight, min_edges, smooth_edges)
			graph_pyvis.show("topic-graph.html")
			with graph_container.container():
				components.html(open("topic-graph.html", 'r', encoding='utf-8').read(), height=625)
		else:
			graph = topic_coocurrence_graph(topic_model(corpus, number_of_topics, number_of_chunks), 
				corpus, number_of_topics, min_weight, min_edges)
			with graph_container.container():
				st.graphviz_chart(graph)
		with st.expander("Topic sentences"):
			show_topic_sentences(corpus, number_of_topics, number_of_chunks, min_weight)
def run_slr_analysis(grammar):
    st.write("## SLR analysis")
    st.write("")

    is_slr = is_slr_grammar(grammar)
    st.write(f"__Your grammar is {'' if is_slr else 'not '} SLR__")

    action, goto = build_slr_tables(grammar)
    st.write("__ACTION:__", table_to_dataframe(action))
    st.write("__GOTO:__", table_to_dataframe(goto))

    automaton = build_automaton(grammar)
    st.write("__LR0 Automaton:__")
    st.graphviz_chart(str(automaton))

    if is_slr:
        tree_builder = get_derivation_tree_builder(grammar)
        string = st.text_input("Please enter a string to parse").split()
        if not string:
            return
        tree = tree_builder(string)
        st.graphviz_chart(str(tree))

    else:
        conflict = build_conflict_str(grammar)
        conflict = " ".join(str(t) for t in conflict)
        st.write(
            "A possible string that leads to a conflict when trying to parse it is:"
        )
        st.write(f"> __{conflict.strip()}__ ...")
def run_ll_analysis(grammar):
    st.write("## LL Analysis")
    st.write("")

    is_ll = is_ll_grammar(grammar)
    st.write(f"__Your grammar is {'' if is_ll else 'not '} LL__")

    table = build_ll_table(grammar)
    st.write("__Parsing Table:__", table_to_dataframe(table))

    if is_ll:
        tree_builder = get_derivation_tree_builder(grammar)
        string = st.text_input("Please enter a string to parse").split()
        if not string:
            return
        tree = tree_builder(string)
        st.graphviz_chart(str(tree))

    else:
        conflict = build_conflict_str(grammar)
        conflict = " ".join(str(t) for t in conflict)
        st.write(
            "A possible string that leads to a conflict when trying to parse it is:"
        )
        st.write(f"> __{conflict.strip()}__ ...")
示例#6
0
def visualize_tickets(user):
    sql1 = f"""select ticket_id ,title  from tickets where 
            ms_id in (select id from management_system where managerid = {str(user['id'][0])});"""
    data = query_db(sql1)
    if data.empty == False:
        st.subheader('Graph a ticket')
        tickets = []
        for t in data.values.tolist():
            temp = f'{str(t[0])} : {t[1]}'
            tickets.append(temp)

        selT = st.selectbox('Select Ticket for a graph:', tickets)
        selT = selT.split(":")[0]
    sql = f"""select issue_reporter.name as reporter,temp.title,temp.issuer_id as 
    issuer_id,temp.emp_id,temp.emp_name from (select t.issuer_id,t.title,t.assigned_to_id as 
    emp_id,e.name as emp_name from tickets t,employees e where e.id = t.assigned_to_id and t.ticket_id={selT}) 
    temp, issue_reporter where issue_reporter.id=temp.issuer_id;"""
    data = query_db(sql)
    st.dataframe(data)
    graph = graphviz.Digraph()
    graph.edge("reporter - " + str(data['reporter'][0]),
               "ticket - " + str(data['title'][0]))
    graph.edge("worker - " + str(data['emp_name'][0]),
               "ticket - " + str(data['title'][0]))
    st.graphviz_chart(graph)
示例#7
0
def draw_activity_tree(root: Node, rules) -> DotExporter:
    fig = DotExporter(
        root,
        options=["rankdir = LR;"],
        nodenamefunc=lambda n: f"{n.name}\ncount={n.count}",
        nodeattrfunc=lambda node: f'penwidth={5 if node.is_activity else 1}')

    st.graphviz_chart(''.join(fig))
    return fig
示例#8
0
    def test_dot(self):
        """Test that it can be called with dot string."""
        graph = graphviz.Graph(comment='The Round Table')
        graph.node('A', 'King Arthur')
        graph.node('B', 'Sir Bedevere the Wise')
        graph.edges(['AB'])

        st.graphviz_chart(graph)

        c = self.get_delta_from_queue().new_element.graphviz_chart
        self.assertEqual(hasattr(c, 'spec'), True)
示例#9
0
def draw_page_tree(root: Node, max_count: int) -> DotExporter:
    # color is HSV; saturation determines color intensity
    fig = DotExporter(
        root,
        options=["rankdir = LR; node [color=black, style=filled];"],
        nodenamefunc=lambda n: f"{n.name}\ncount={n.count}",
        nodeattrfunc=lambda node: f'fillcolor="0.6 {node.count / max_count} 1"'
    )

    st.graphviz_chart(''.join(fig))
    return fig
示例#10
0
    def test_dot(self):
        """Test that it can be called with dot string."""
        graph = graphviz.Graph(comment="The Round Table")
        graph.node("A", "King Arthur")
        graph.node("B", "Sir Bedevere the Wise")
        graph.edges(["AB"])

        st.graphviz_chart(graph)

        c = self.get_delta_from_queue().new_element.graphviz_chart
        self.assertEqual(hasattr(c, "spec"), True)
示例#11
0
    def test_use_container_width_true(self):
        """Test that it can be called with use_container_width."""
        graph = graphviz.Graph(comment="The Round Table")
        graph.node("A", "King Arthur")
        graph.node("B", "Sir Bedevere the Wise")
        graph.edges(["AB"])

        st.graphviz_chart(graph, use_container_width=True)

        c = self.get_delta_from_queue().new_element.graphviz_chart
        self.assertEqual(c.use_container_width, True)
示例#12
0
def spell(spell_inputs):
    mana = spell_inputs
    st.write("Training text model")

    SPACY_MODEL_NAMES = ["en_core_web_sm", "en_core_web_md", "en_core_sci_sm"]

    spacy_model = st.selectbox("Model name", SPACY_MODEL_NAMES)
    model_load_state = st.info(f"Loading model '{spacy_model}'...")
    nlp = load_model(spacy_model)
    # nlp = spacy.load("en_core_web_sm")
    model_load_state.empty()

    try:
        doc = nlp(mana)
    except:
        st.error("Mana input is not sutiable for spacy model, using sample text")
        mana = "The tiger jumped over the table"
        st.write(mana)
        doc = nlp(mana)

    ents = []
    rels = []

    for sent in doc.sents:
        ent = get_entities(sent.text,nlp)
        rel = get_relation(sent.text,nlp)
        ents.append(ent)
        rels.append(rel)
        html = displacy.render(sent)
        html = html.replace("\n\n", "\n")
        st.write(HTML_WRAPPER.format(html), unsafe_allow_html=True)

    # extract subject
    source = [i[0] for i in ents]

    # extract object
    target = [i[1] for i in ents]

    kg_df = pd.DataFrame({'source':source, 'target':target, 'edge':rels})
    st.dataframe(kg_df)


    #ent_rels = parse_doc(doc,nlp)
    #t.write(ent_rels)
    

    graph = graphviz.Digraph()
    kg_df.apply(lambda row: make_ent_rel_graph(row,graph), axis=1)
    st.graphviz_chart(graph)

    # print ents and rels...

    return None, mana
示例#13
0
def parser_LALR1():
    """
    LALR(1) Subsection
    """
    st.title('Parser LALR(1)')

    result = gp.load_grammar()
    if result[0]:
        st.error('No se ha definido una gramatica\
            o la gramatica definida no es correcta')
        return

    options = ['Tabla de parsing', 'Autómata LALR(1)', 'Parsear cadena']

    G = result[1]

    lalr1_parser = LALR1Parser(G)

    if len(lalr1_parser.conflicts) > 0:
        options.remove('Parsear cadena')

        if lalr1_parser.conflicts[0].type == SHIFT_REDUCE:
            st.error('La gramática definida tiene conflictos\
                Shift-Reduce')
        if lalr1_parser.conflicts[0].type == REDUCE_REDUCE:
            st.error('La gramática definida tiene conflictos\
                Reduce-Reduce')

        for conf in lalr1_parser.conflicts:
            st.code(f'{conf.value[0]}\n{conf.value[1]}')

        # TODO Report conflict string...
        # r1, r2 = generate_lr_conflict_string(G, lalr1_parser)
        # st.subheader('Cadenas de conflicto:')
        # st.code(f'{r1}\n{r2}')

    selected = st.multiselect('', options)

    if 'Tabla de parsing' in selected:
        lalr1_parser._build_parsing_table()
        goto = LR_table_to_dataframe(lalr1_parser.goto)
        action = LR_table_to_dataframe(lalr1_parser.action)
        st.title('GOTO')
        st.write(goto)
        st.title('Action')
        st.write(action)
    if 'Autómata LALR(1)' in selected:
        st.title('Automata LALR(1)')
        automaton = build_LALR1_automaton(
            lalr1_parser.G.AugmentedGrammar(True))
        st.graphviz_chart(str(automaton.graph()))
    if 'Parsear cadena' in selected:
        render_parser(G, 'método LALR(1)', lalr1_parser)
示例#14
0
def render(result):
    if "text" == result.type:
        st.write(result.payload)
    if "markdown" == result.type:
        st.markdown(result.payload)
    if "json" == result.type:
        st.json(result.payload)
    if "graphviz" == result.type:
        st.graphviz_chart(result.payload)
    if "html" == result.type:
        st.write(result.payload, unsafe_allow_html=True)
        if result.extra_json:
            st.json(result.extra_json)
def dt_regression(X, y, max_depth):
    X_train, X_test, y_train, y_test = train_test_split(X,
                                                        y,
                                                        test_size=0.25,
                                                        random_state=42)
    model = DecisionTreeRegressor(max_depth=max_depth)
    model.fit(X_train, y_train)
    pred_results = model.predict(X_test)
    result = regression(y_test, pred_results, model)
    st.write("Evaluation Metrics ", result)
    dot_data = export_graphviz(model, filled=True, rounded=True, out_file=None)
    st.graphviz_chart(dot_data)
    return
示例#16
0
def parse_subj():
    lang = 'ru'
    sents = 'Яблоко - это здоровый фрукт.'
    st.write(sents)
    data = {'lang': lang, "sents": sents, 'engine': cf.engine(lang)}
    doc_jsonify, resp = parse_sents(data)

    domains = get_subj_domain(doc_jsonify)
    testing(domains, 'ru')

    gv = display_doc_deps(doc_jsonify, resp)
    st.graphviz_chart(gv)

    st.write(domains)
示例#17
0
    def feature_relevance(self, dataset: pd.DataFrame):
        st.write("## Feature relevance analysis")

        columns = list(dataset.columns)
        predict_column = st.selectbox("Prediction column", columns, len(columns) - 1)

        y = dataset[predict_column]
        X = list(dataset.drop(columns=predict_column).to_dict("index").values())

        st.write("#### Numerical feature relevance")

        features = pd.DataFrame(
            [
                dict(feature=k, relevance=v, target=c)
                for c, weights in get_feature_relevance(X, y)
                for k, v in weights.items()
            ]
        )
        st.write(features)

        features["sign"] = (features["relevance"] > 0).astype(bool)
        features["abs"] = features["relevance"].abs()

        st.write("#### Graphical representation")

        st.write(
            alt.Chart(features)
            .mark_circle()
            .encode(x="feature", y="target", color="sign", size="abs",)
        )

        st.write("#### Decision Tree")

        depth = st.number_input("Max tree depth", 1, 10, 3)
        st.graphviz_chart(get_decision_tree(X, y, depth=depth))

        st.write("#### Features correlation")

        X = list(dataset.to_dict("index").values())
        corr = get_correlation(X)

        if st.checkbox("Show correlation table"):
            st.write(corr)

        st.write(
            alt.Chart(corr.reset_index().melt(id_vars="index"))
            .mark_rect()
            .encode(x="index", y="variable", color="value")
        )
示例#18
0
def parse_deps(text, lang, translit=None):
    text = fix_sents(text, lang)
    engine = cf.engine(lang)
    # g = sentence_view(lang, text, engine=engine, translit_lang=lang, enable_contrast=True)
    doc_jsonify, resp = dep_parse(text, lang, engine, ['predicts'])
    if doc_jsonify is not None:
        list_chunks(doc_jsonify, resp, lang, enable_contrast=True)
        g = display_doc_deps(doc_jsonify, resp, translit_lang=lang)

        st.graphviz_chart(g)
        if translit is not None:
            st.text(f"♤ {translit}")

        words = [word.text for word in doc_jsonify.words]
        tools.contrast(text, lang, word_map=words)
示例#19
0
def draw_graph(times, order):
    graph = graphviz.Digraph()
    colorx = .000
    for current in order:
        final_color = f'{colorx} .999 .400'
        for i, v in enumerate(current):
            if i == len(current) - 1:
                continue
            time = str(times[i]).replace(":", " ")
            time2 = str(times[i+1]).replace(":", " ")
            node1 = v.name + " " + time
            node2 = current[i+1].name + " " + time2
            graph.edge(node1, node2, color=final_color)
        colorx += .070
    st.graphviz_chart(graph)
示例#20
0
def parse_aux():
    lang = 'en'
    sents = 'what will be the weather in three days?'
    st.write(sents)
    data = {'lang': lang, "sents": sents, 'engine': cf.engine(lang)}
    doc_jsonify, resp = parse_sents(data)

    domains = get_aux_domain(doc_jsonify)
    testing(domains, 'en')

    # show analyse graph
    gv = display_doc_deps(doc_jsonify, resp)
    st.graphviz_chart(gv)

    st.write(domains)
示例#21
0
def render_show_expression(tensor=False):

    if tensor:
        st.text(
            "Build an expression of tensors x, y, and z. (All the same shape)")
        code = st.text_area(label="Expression of x,y,z",
                            value="(x * x) * y + 10.0 * x.sum()")
        out = graph_builder.build_tensor_expression(code)
    else:
        code = st.text_area(label="Expression of x,y,z",
                            value="(x * x) * y + 10.0 * x")
        out = graph_builder.build_expression(code)

    G = graph_builder.GraphBuilder().run(out)
    G.graph["graph"] = {"rankdir": "LR"}
    st.graphviz_chart(nx.nx_pydot.to_pydot(G).to_string())
示例#22
0
def instruction_graph():
    graph = graphviz.Digraph()
    graph.edge("Home", "Register")
    graph.edge("Home", "Login")
    graph.edge("Register", "Enter email address and password")
    graph.edge("Enter email address and password", "Login")
    graph.edge("Login", "Select type of dataset")
    graph.edge("Select type of dataset", "Upload training dataset")
    graph.edge("Upload training dataset",
               "Select columns for which prediction hast to be done")
    graph.edge("Select columns for which prediction hast to be done",
               "Upload test dataset[Optional]")
    graph.edge("Upload test dataset[Optional]", "Click on start button")
    graph.edge("Click on start button",
               "Download predicted file and pickle model of best algorithm")
    st.graphviz_chart(graph)
示例#23
0
def networkx():
    G = nx.Graph()
    G2 = Network(notebook=True, height='800px', width='800px')
    G2.from_nx(G)

    path_to_imgs = './nx_images'
    html_file = './nx.html'

    prev = ''
    imgs = os.listdir(path_to_imgs)
    for index, img in enumerate(imgs):
        next_index = random.randint(0, index)
        print(next_index)
        img_path = os.path.join(path_to_imgs, img)
        #print(img_path)
        G2.add_node(img, shape='image', image=img_path)
        if prev != '':
            G2.add_edge(img, prev)
            prev = img
        if not index:
            continue
        if next_index == index:
            continue
        next = imgs[next_index]
        G2.add_edge(img, next)

    with st.spinner('Loading...'):
        time.sleep(3)
    st.success('Loaded!')

    html_file = '/home/mayank/repo/pyTIB/src/streamlit/tutorials/g.html'
    G2.show(html_file)
    with open(html_file, 'r') as html_handle:
        html_content = html_handle.read()
        print(html_content)

    #url = './nx_images/aadhaar_c_nt.svg'
    url = 'https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/410.svg'
    url = './nx_images/410.svg'
    components.html(f'<img src="{url}" />', height=800, width=800)
    #st.write(html_content, unsafe_allow_html=True)
    #components.iframe('file:///tmp/z.html')

    if False:
        K5 = nx.complete_graph(5)
        dot = nx.nx_pydot.to_pydot(K5)
        st.graphviz_chart(dot.to_string())
def run_regular_analysis(grammar):
    st.write("## Regular Language Analysis")
    st.write("")

    is_regular = is_regular_grammar(grammar)
    st.write(f"__Your grammar is {'' if is_regular else 'not '} Regular__")

    if not is_regular:
        return

    automaton = grammar_to_automaton(grammar)
    st.graphviz_chart(str(automaton.graph()))

    regex = automaton_to_regex(automaton)
    st.write(f"_A regular expression to represent your grammar could be:_")
    st.write(f"> {regex}")
    st.write("where '@' doesn't match any symbol in your vocabulary")
def decision_tree(X, Y, labels, dataset_name, random_state, criterion,
                  ccp_alpha, min_samples_split):
    X_train, X_test, y_train, y_test = train_test_split(X,
                                                        Y,
                                                        test_size=0.20,
                                                        random_state=42)
    model = DecisionTreeClassifier(random_state=random_state,
                                   criterion=criterion,
                                   ccp_alpha=ccp_alpha,
                                   min_samples_split=min_samples_split)
    model_name = "Decision Tree"
    scikit_validation_and_testing(X, Y, X_train, y_train, X_test, y_test,
                                  model, dataset_name, model_name, labels)
    st.subheader(model_name)
    dot_data = export_graphviz(model, filled=True, rounded=True, out_file=None)
    st.graphviz_chart(dot_data)
    return model
示例#26
0
def main():
    st.header("Let the hunt begin!")
    show_possible_anomalies = st.checkbox("Show possible anomalies?")
    if show_possible_anomalies:
        detected_with_multible_methods()

    file_name, df = select_file(Path('processed'), default='dt_sessions_1k.csv')
    attr_mapping = attribute_mapper.show(df.columns)
    log = EventLog(df, **attr_mapping, ts_parse_params={})

    st.write(file_name)

    if 'cluster' in log._df:
        ranked_traces = rank_traces_by_cluster_size(log)

    show_dotted_chart(log)
    viz = mine_process(log)
    if viz:
        st.graphviz_chart(viz)
示例#27
0
def ent_rel_graph(ents, rels, keyspace):

    graph = graphviz.Digraph(keyspace)

    # for all ents get the attrs
    # st.write(rels)

    ent_keys = list(ents.keys())

    for key in ent_keys:
        graph.node(key, shape="box", style="filled", color="#b19cd9")

        for attr in ents[key]["cols"]:
            graph.edge(key, attr, label="has")
            graph.node(attr, style="filled", color="#add8e6")

    rel_keys = list(rels.keys())

    for rel in rel_keys:
        graph.node(rel, shape="diamond", style="filled", color="#90ee90")

        # check rel1
        rel1_ent = rels[rel]["rel1"]["entity"]
        rel1_label = rels[rel]["rel1"]["role"]
        graph.edge(rel, rel1_ent, label=rel1_label)

        # check rel2
        rel2_ent = rels[rel]["rel2"]["entity"]
        rel2_label = rels[rel]["rel2"]["role"]
        graph.edge(rel, rel2_ent, label=rel2_label)

        # check attrs
        for col in rels[rel]["cols"]:
            if col == "codex_details":
                continue
            graph.edge(rel, col, label="has")
            graph.node(col, style="filled", color="#add8e6")

    if len(ent_keys) > 0:
        graph.attr(fontsize="20")
        graph.attr(label=r"\n\nEntity Relation Diagram\ for " + keyspace)
        st.graphviz_chart(graph)
示例#28
0
def row_view(row):
    text = row[1]
    if display_translit and len(row) > 2:
        label = row[2]
    else:
        label = text
    if st.button(f"{label} ✁ {row[0]}"):
        text = fix_sents(text, lang)
        engine = get_engine(lang)
        # g = sentence_view(lang, text, engine=engine, translit_lang=lang, enable_contrast=True)
        doc_jsonify, resp = dep_parse(text, lang, engine, ['predicts'])
        if doc_jsonify is not None:
            list_chunks(doc_jsonify, resp, lang, enable_contrast=True)
            g=display_doc_deps(doc_jsonify, resp, translit_lang=lang)

            st.graphviz_chart(g)
            if len(row) > 2:
                st.text(f"♤ {row[2]}")

            words = [word.text for word in doc_jsonify.words]
            tools.contrast(text, lang, word_map=words)
示例#29
0
def run_lr_analysis(grammar):
    st.write("## LR analysis")
    st.write("")

    is_lr = is_lr_grammar(grammar)
    st.write(f"__Your grammar is {'' if is_lr else 'not '} LR__")

    action, goto = build_lr_tables(grammar)
    st.write("__ACTION:__", table_to_dataframe(action))
    st.write("__GOTO:__", table_to_dataframe(goto))

    if not is_lr:
        conflict = build_conflict_str(grammar)
        conflict = " ".join(str(t) for t in conflict)
        st.write(
            "A possible string that leads to a conflict when trying to parse it is:"
        )
        st.write(f"> __{conflict.strip()}__ ...")

    automaton = build_automaton(grammar)
    st.write("__LR0 Automaton:__")
    st.graphviz_chart(str(automaton))
示例#30
0
def parser_LALR1():
    """
    LALR(1) Subsection
    """
    st.title('Parser LALR(1)')

    result = gp.load_grammar()
    if result[0]:
        st.error('No se ha definido una gramatica\
            o la gramatica definida no es correcta')
        return

    G = result[1]
    lalr1_parser = LALRParser(G)
    # try:
    #     lalr1_parser = LALRParser(G)
    # except Exception:
    #     st.error('La gramática definida tiene conflictos\
    #         Shift-Reduce o Reduce-Reduce')
    # return

    options = ['Tabla de parsing', 'Autómata LALR(1)', 'Parsear cadena']

    selected = st.multiselect('', options)

    if options[0] in selected:
        lalr1_parser._build_parsing_table()
        goto = LR_table_to_dataframe(lalr1_parser.goto)
        action = LR_table_to_dataframe(lalr1_parser.action)
        st.title('GOTO')
        st.write(goto)
        st.title('Action')
        st.write(action)
    if options[1] in selected:
        st.title('Automata LR(0)')
        automaton = build_lalr_automaton(lalr1_parser.G.AugmentedGrammar(True))
        st.graphviz_chart(str(automaton.graph()))
    if options[2] in selected:
        render_parser(G, 'método LALR(1)', lalr1_parser)