123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- import suggests
- import networkx as nx
- import pyvis
- import time
- from pyvis.network import Network
- import pickle
- #kw='覆髓'p
- #kw='塗氟'
- #kw='口掃機'
- #kw='牙醫助理'
- #kw='牙材'
- #kw='牙醫師公會'
- #kw='防齲'
- #kw='齒模'
- #kw='金屬牙套'
- #kw='醫療法'
- #kw='牙醫師手冊'
- #kw='貝氏刷牙'
- #kw='牙醫積分'
- #kw='牙醫師'
- #kw='牙醫全聯會'
- #kw='牙醫系'
- #kw='台大牙醫'
- #kw='成大牙醫'
- #kw='陽明牙醫'
- #kw='北醫牙醫'
- #kw='醫學系公費生'
- #kw='醫學系自費生'
- #kw='北醫牙醫'
- #kw='牙醫學會'
- #kw='牙醫總額'
- #kw='牙醫健保'
- #kw='文化資產'
- #kw='藝文團體'
- #kw='書房 設計'
- #kw='室內設計'
- #kw='2021風水擺設'
- #kw='電視牆'
- #kw='系統櫃'
- #kw='收納'
- #kw='軟糖'
- #kw='手工餅乾'
- #kw='白巧克力'
- #kw='黑巧克力'
- #kw='蜜糖吐司'
- #kw='舒芙蕾'
- #kw='馬卡龍'
- #kw='馬林糖'
- #kw='檸檬塔'
- #kw='泡芙'
- kw='mean snapchat'
- #kw='留學'
- #kw='勞力士'
- #kw='白蟻'
- #kw='影片製作'
- #kw='ai 合成'
- #kw='菲律賓'
- #kw='生巧克力'
- #kw='牛奶巧克力'
- #kw='廣告投放策略'
- #s={'suggests':[]}
- s = suggests.suggests.get_suggests(kw, source='google')
- G = nx.Graph()
- #G = pickle.load( open( "gs2.p", "rb" ) )
- #G.remove_node('巧克力囊腫')
- #G.remove_node('巧克力雲莊')
- for sg in s['suggests']:
- G.add_edge(kw,sg,weight=1)
- print(sg)
- time.sleep(1)
- s2 = suggests.suggests.get_suggests(sg, source='google')
- for elmt in s2['suggests']:
- G.add_edge(sg,elmt,weight=1)
- G.remove_nodes_from(list(nx.isolates(G)))
- G.remove_edges_from( list(nx.selfloop_edges(G)))
- pickle.dump( G, open( "gs2.p", "wb" ) )
- pyG = Network(height="750px", width="100%",bgcolor="#333333",font_color="white")
- pyG.from_nx(G)
- pyG.show('gs.html')
|