Skip to content

Commit

Permalink
Small modifications due to weird changes in output in SWUM
Browse files Browse the repository at this point in the history
  • Loading branch information
cnewman committed Nov 27, 2024
1 parent 391a437 commit a383c78
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions ensemble_tagger_implementation/ensemble_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def Process_identifier_with_swum(identifier_data, context_of_identifier):
split_identifier_name = '_'.join(ronin.split(identifier_type_and_name[1]))
if Get_identifier_context(context_of_identifier) != CODE_CONTEXT.FUNCTION:
swum_string = "{identifier_type} {identifier_name}".format(identifier_name = split_identifier_name, identifier_type = identifier_type_and_name[0])
print(['java', '-jar', '../SWUM/SWUM_POS/swum.jar', swum_string, '2', 'true'])
swum_process = subprocess.Popen(['java', '-jar', '../SWUM/SWUM_POS/swum.jar', swum_string, '2', 'true'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
else:
split_identifier_name = split_identifier_name+'('+identifier_data.split('(')[1]
Expand Down
7 changes: 4 additions & 3 deletions ensemble_tagger_implementation/preprocess_identifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ def Split_raw_identifier(identifier_data):
return identifier_type_and_name

def Parse_swum(swum_output, split_identifier_name):
code_context = swum_output.split('#')
code_context = swum_output.split(':')
print(code_context)
raw_grammar_pattern = grammar_pattern = identifier = []
if code_context[0] == 'FIELD':
identifier = code_context[1].split('-')[1].split()
identifier = code_context[2].split('-')[1].split()
raw_grammar_pattern = re.findall('([A-Z]+)', ' '.join(identifier))
else:
identifier = code_context[1].split('@')[1].split('|')
identifier = code_context[3].split('|')
raw_grammar_pattern = re.findall('([A-Z]+)', ' '.join(identifier))

for pos in raw_grammar_pattern:
Expand Down
2 changes: 1 addition & 1 deletion srcSAXEventDispatch

0 comments on commit a383c78

Please sign in to comment.