In the following functions, i want to search, for example, the string 'BAB' in hmm. The code cannot find it and i could not fix it. Thanks for your help
def TrialSystem () :
hmm = {}
hmm [0] = ({ 'A ' :0.3 , 'B ' :0.2 , 'C ' :0.5 } , 1 )
hmm [1] = ({ 'A ' :0.1 , 'B ' :0.8 , 'C ' :0.1} , 2)
hmm [2] = ({ 'A ' :0.4 , 'B ' :0.6} , -1 )
return hmm
def ERecall ( hmm , strng ) :
prb = 1
N = len ( strng )
for i in range ( N ) :
if strng [ i ] in hmm [ i ][0]:
prb *= hmm [ i ][0][ strng [ i ] ]
else :
prb = 0
break
return prb
def TrialSystem () :
hmm = {}
hmm [0] = ({ 'A ' :0.3 , 'B ' :0.2 , 'C ' :0.5 } , 1 )
hmm [1] = ({ 'A ' :0.1 , 'B ' :0.8 , 'C ' :0.1} , 2)
hmm [2] = ({ 'A ' :0.4 , 'B ' :0.6} , -1 )
return hmm
def ERecall ( hmm , strng ) :
prb = 1
N = len ( strng )
for i in range ( N ) :
if strng [ i ] in hmm [ i ][0]:
prb *= hmm [ i ][0][ strng [ i ] ]
else :
prb = 0
break
return prb
buran write Mar-28-2023, 11:38 AM:
Please, fix the identation and use proper tags when post code, traceback, output, etc.
See BBcode help for more info.
Please, fix the identation and use proper tags when post code, traceback, output, etc.
See BBcode help for more info.