Ejemplo n.º 1
0
 def get_incoming_arcs(self) -> _k2.RaggedInt:
     '''Get (and compute if necessary) cached property self.incoming_arcs
        For use by internal k2 code, relates to best-path'''
     if hasattr(self, 'incoming_arcs') is False:
         dest_states = self.get_dest_states()
         incoming_arcs = _k2._get_incoming_arcs(self.arcs, dest_states)
         self._update_cache('incoming_arcs', incoming_arcs)
     return self.incoming_arcs
Ejemplo n.º 2
0
Archivo: fsa.py Proyecto: ts0923/k2
 def get_incoming_arcs(self) -> _k2.RaggedInt:
     '''Get (and compute if necessary) cached property self.incoming_arcs
        For use by internal k2 code, relates to best-path'''
     name, cache = 'incoming_arcs', self._cache
     if name not in cache:
         cache[name] = _k2._get_incoming_arcs(self.arcs,
                                              self.get_dest_states())
     return cache[name]
Ejemplo n.º 3
0
 def update_incoming_arcs(self) -> _k2.RaggedInt:
     if hasattr(self, 'incoming_arcs') is False:
         dest_states = self.update_dest_states()
         incoming_arcs = _k2._get_incoming_arcs(self.arcs, dest_states)
         self._update_cache('incoming_arcs', incoming_arcs)
     return self.incoming_arcs