def encode(self,seq): graph=[] fs=[self.fid.test(cws_transform.gen_keys(seq,x)) for x in range(len(seq))] for v in fs: graph.append([0,[],0,v]) graph[0][0]+=1; graph[-1][0]+=2; for i in range(1,len(graph)): graph[i][1]=[i-1] return graph
def encode(self,seq): seq=self.map_seq(seq) graph=[] fs=[filter(lambda x:x>=0,[self.fid(k) for k in cws_transform.gen_keys(seq,x)]) for x in range(len(seq))] for v in fs: graph.append([0,[],0,v]) graph[0][0]+=1; graph[-1][0]+=2; for i in range(1,len(graph)): graph[i][1]=[i-1] return graph
def encode(self, seq): graph = [] fs = [ self.fid.test(cws_transform.gen_keys(seq, x)) for x in range(len(seq)) ] for v in fs: graph.append([0, [], 0, v]) graph[0][0] += 1 graph[-1][0] += 2 for i in range(1, len(graph)): graph[i][1] = [i - 1] return graph
def encode(self, seq): seq = self.map_seq(seq) graph = [] fs = [ filter(lambda x: x >= 0, [self.fid(k) for k in cws_transform.gen_keys(seq, x)]) for x in range(len(seq)) ] for v in fs: graph.append([0, [], 0, v]) graph[0][0] += 1 graph[-1][0] += 2 for i in range(1, len(graph)): graph[i][1] = [i - 1] return graph