<｜begin▁of▁sentence｜>### Instruction:
Given a graph based on Word Adjacencies which you can read from a GML file named adjnoun.gml, can you use threshold_clustering function in cdlib with the median as the threshold function to perform community detection? And can you output the result in JSON format?
### Response:
import networkx as nx
from cdlib import algorithms
import numpy as np

# Create a graph from Word Adjacencies
G = nx.read_gml('adjnoun.gml')

# Apply Threshold Clustering algorithm with median as the threshold function
communities = algorithms.threshold_clustering(G, threshold_function=np.median)

# Convert communities to JSON
json_communities = communities.to_json()

# Print communities in JSON format
print(json_communities)
<|EOT|>
