MCPcopy Index your code
hub / github.com/modelscope/FunASR / is_sublist

Method is_sublist

funasr/utils/kws_utils.py:232–253  ·  view source on GitHub ↗

Is sublist. Args: main_list: TODO. check_list: TODO.

(self, main_list, check_list)

Source from the content-addressed store, hash-verified

230
231
232 def is_sublist(self, main_list, check_list):
233 """Is sublist.
234
235 Args:
236 main_list: TODO.
237 check_list: TODO.
238 """
239 if len(main_list) < len(check_list):
240 return -1
241
242 if len(main_list) == len(check_list):
243 return 0 if main_list == check_list else -1
244
245 for i in range(len(main_list) - len(check_list) + 1):
246 if main_list[i] == check_list[0]:
247 for j in range(len(check_list)):
248 if main_list[i + j] != check_list[j]:
249 break
250 else:
251 return i
252 else:
253 return -1
254
255
256 def _decode_inside(

Callers 1

_decode_insideMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected