Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if not G.has_edge(node1,node2):
G.add_edge(node1,node2,weight=0,penwidth=0,color='white')
"""
fn='results/fsms/'+str(gtype)+"."+name+'.png'
print(">> saved: "+fn+"")
#plt.savefig(fn)
#nx.write_dot(G,fn)
pyd=nx.to_pydot(G)
pyd.set_rankdir('LR')
for node in pyd.get_node_list():
node.set_orientation('portrait')
import prosodic as p
fnfn=os.path.join(p.dir_prosodic,fn)
_path=os.path.split(fnfn)[0]
if not os.path.exists(_path):
os.makedirs(_path)
pyd.write_png(fnfn, prog='dot')
else:
if not self.children:
return ""
elif type(self.children[0])==type([]):
return []
else:
[child.genfsms() for child in self.children]
self.featpaths={}
self.__parses={}
self.__bestparses={}
self.__boundParses={}
self.__parsed_ents={}
self.phrasebreak_punct = str(",;:.?!()[]{}<>")
self.phrasebreak=prosodic.config['linebreak'].strip()
self.limWord = limWord
self.isFromFile = False
self.feats = {}
self.children = []
self.isUnicode=True
self.use_dict=use_dict
self.fix_phons_novowel=fix_phons_novowel
self.stress_ambiguity=stress_ambiguity
self.dir_prosodic=prosodic.dir_prosodic
self.dir_results=prosodic.dir_results
self.config=prosodic.config
self.dir_nlp_data = prosodic.dir_nlp_data
self.dir_mtree = prosodic.dir_mtree
self.meter=self.config['meters'][meter] if meter and meter in self.config['meters'] else None
self._sentences=[]
#self.meterd={]}
## phrasebreak features
if self.phrasebreak=='line':
pass
elif self.phrasebreak.startswith("line"):
self.phrasebreak_punct=str(self.phrasebreak.replace("line",""))
self.phrasebreak='both'