- 论坛徽章:
- 0
|
- #s为句法树
- s = '''(ROOT
- (S
- (PP (IN In)
- (NP (DT this) (NN study)))
- (, ,)
- (NP (PRP we))
- (VP (VBD examined)
- (NP
- (NP (DT the) (NN expression))
- (PP (IN of)
- (NP (JJ let-7) (NNS miRNAs))))
- (PP (IN in)
- (NP
- (NP (JJ human) (NN colon) (NN cancer) (NNS tumors))
- (CC and)
- (NP (NN cell) (NNS lines))))
- (, ,)
- (PP (IN with)
- (NP
- (NP (DT the) (NN result))
- (SBAR (IN that)
- (S
- (NP
- (NP (CD 2))
- (PP (IN of)
- (NP
- (NP (CD 6) (NNS cases))
- (CC and)
- (NP (CD 1))))
- (PP (IN of)
- (NP (CD 3) (NN cell) (NNS lines))))
- (VP (VBD showed)
- (NP
- (NP (VBN reduced) (NN expression))
- (PP (IN of)
- (NP (NN let-7))))))))))
- (. .)))
- '''
- str1="reduced"
- str2="let-7"
- temp=[]
- link=[]
- s=s.replace('(', ' ( ')
- s=s.replace(')', ' ) ')
- list=s.split()
- print list
- for word in list:
- #print word,
- while True:
- string=list.pop(0)
- temp.append(string)
- #print string,
- if string==')':
- break
- print temp
复制代码 请问:这个为什么读不到底 ?先谢谢了 |
|