Untitled
unknown
plain_text
4 months ago
2.0 kB
1
Indexable
from matplotlib import pyplot as plt import networkx as nx # Create a mindmap structure for the linguistic principles mindmap = { "Linguistic Principles": { "General Principles of Language Teaching": { "Naturalness": ["Listening and speaking before writing", "Natural exposure to language"], "Learning by Self-Doing": ["Active participation", "Practical exercises"], "Speaking": ["Focus on oral skills", "Auditory capabilities"], "Ratio and Sequence": ["Logical progression", "From simple to complex"], "Context and Situation": ["Real-world contexts", "Meaningful learning"] }, "Principle of Selection": { "Focus Areas": ["Frequency", "Range", "Availability", "Teachability"], "Gradation": ["Simple to complex", "Logical sequencing"] }, "Maxims of Teaching": { "Known to Unknown": [], "Simple to Complex": [], "Concrete to Abstract": [], "Particular to General": [] }, "Summary": ["Natural teaching methods", "Skill progression", "Context-based learning"] } } # Initialize a graph G = nx.DiGraph() # Recursive function to add nodes and edges def add_nodes_edges(graph, parent, children): for key, value in children.items(): graph.add_edge(parent, key) if isinstance(value, dict): add_nodes_edges(graph, key, value) elif isinstance(value, list): for item in value: graph.add_edge(key, item) # Add nodes and edges to the graph add_nodes_edges(G, "Linguistic Principles", mindmap["Linguistic Principles"]) # Draw the mindmap plt.figure(figsize=(14, 10)) pos = nx.spring_layout(G, k=0.6) # Positioning the nodes nx.draw(G, pos, with_labels=True, node_size=5000, node_color="lightblue", font_size=10, font_weight="bold") plt.title("Mindmap of Linguistic Principles", fontsize=15) plt.show()
Editor is loading...
Leave a Comment