def classifiy_commits_df(df): df['corrective_pred'] = df.message.map(lambda x: is_fix(x)) df['is_refactor_pred'] = df.message.map(lambda x: built_is_refactor(x)) df['perfective_pred'] = df.message.map(lambda x: (match(x, build_perfective_regex())) + (match(x, build_refactor_regex())) > 0) df['adaptive_pred'] = df.message.map(lambda x: is_adaptive(x) > 0) return df
def built_is_refactor(commit_text): removal_re = build_sepereted_term(removal) return (match(commit_text, build_refactor_regex()) + match(commit_text, removal_re) + match(commit_text, build_refactor_goals_regex()) - match(commit_text, build_non_code_perfective_regex()) - match(commit_text, build_documentation_entities_context(build_refactor_regex())) - match(commit_text, build_non_positive_linguistic(build_refactor_regex())) - match(commit_text, build_non_positive_linguistic(build_sepereted_term(removal))) - match(commit_text, build_non_positive_linguistic(build_refactor_goals_regex())) ) > 0
def is_adaptive(text): return (match(text, build_adaptive_regex()) + match(text, build_adaptive_action_regex()) - match(text, build_non_adaptive_context()) - match(text, build_non_adaptive_linguistic()))
def is_core_refactor(text): return match(text, build_core_refactor_regex())