MCPcopy Create free account
hub / github.com/RingBDStack/GDAP / find_bracket_num

Function find_bracket_num

extraction/predict_parser/target_predict_parser.py:35–49  ·  view source on GitHub ↗

Count Bracket Number, 0 indicate num_left = num_right :param tree_str: :return:

(tree_str)

Source from the content-addressed store, hash-verified

33 return ' '.join(new_text_list) # 空格组合对于中文效果?
34
35def find_bracket_num(tree_str):
36 """
37 Count Bracket Number, 0 indicate num_left = num_right
38 :param tree_str:
39 :return:
40 """
41 count = 0
42 for char in tree_str:
43 if char == left_bracket:
44 count += 1
45 elif char == right_bracket:
46 count -= 1
47 else:
48 pass
49 return count
50
51
52def check_well_form(tree_str):

Callers 2

check_well_formFunction · 0.85
add_bracketFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected