Skip to content

Commit

Permalink
address #300
Browse files Browse the repository at this point in the history
  • Loading branch information
xehu committed Oct 7, 2024
1 parent ec2ed64 commit b55cfc4
Show file tree
Hide file tree
Showing 7 changed files with 1,293 additions and 2,324 deletions.
488 changes: 488 additions & 0 deletions examples/filtered_dict.json

Large diffs are not rendered by default.

120 changes: 60 additions & 60 deletions src/team_comm_tools/feature_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,27 +355,27 @@
},
"Politeness Strategies": {
"columns": [
"please",
"please_start",
"hashedge",
"indirect_btw",
"hedges",
"factuality",
"deference",
"gratitude",
"apologizing",
"1st_person_pl",
"1st_person",
"1st_person_start",
"2nd_person",
"2nd_person_start",
"indirect_greeting",
"direct_question",
"direct_start",
"haspositive",
"hasnegative",
"subjunctive",
"indicative"
"please_politeness_convokit",
"please_start_politeness_convokit",
"hashedge_politeness_convokit",
"indirect_btw_politeness_convokit",
"hedges_politeness_convokit",
"factuality_politeness_convokit",
"deference_politeness_convokit",
"gratitude_politeness_convokit",
"apologizing_politeness_convokit",
"1st_person_pl_politeness_convokit",
"1st_person_politeness_convokit",
"1st_person_start_politeness_convokit",
"2nd_person_politeness_convokit",
"2nd_person_start_politeness_convokit",
"indirect_greeting_politeness_convokit",
"direct_question_politeness_convokit",
"direct_start_politeness_convokit",
"haspositive_politeness_convokit",
"hasnegative_politeness_convokit",
"subjunctive_politeness_convokit",
"indicative_politeness_convokit"
],
"file": "./features/politeness_features.py",
"level": "Chat",
Expand All @@ -391,45 +391,45 @@
},
"Politeness / Receptiveness Markers": {
"columns": [
"Impersonal_Pronoun",
"First_Person_Single",
"Hedges",
"Negation",
"Subjectivity",
"Negative_Emotion",
"Reasoning",
"Agreement",
"Second_Person",
"Adverb_Limiter",
"Disagreement",
"Acknowledgement",
"First_Person_Plural",
"For_Me",
"WH_Questions",
"YesNo_Questions",
"Bare_Command",
"Truth_Intensifier",
"Apology",
"Ask_Agency",
"By_The_Way",
"Can_You",
"Conjunction_Start",
"Could_You",
"Filler_Pause",
"For_You",
"Formal_Title",
"Give_Agency",
"Affirmation",
"Gratitude",
"Hello",
"Informal_Title",
"Let_Me_Know",
"Swearing",
"Reassurance",
"Please",
"Positive_Emotion",
"Goodbye",
"Token_count"
"Impersonal_Pronoun_receptiveness_yeomans",
"First_Person_Single_receptiveness_yeomans",
"Hedges_receptiveness_yeomans",
"Negation_receptiveness_yeomans",
"Subjectivity_receptiveness_yeomans",
"Negative_Emotion_receptiveness_yeomans",
"Reasoning_receptiveness_yeomans",
"Agreement_receptiveness_yeomans",
"Second_Person_receptiveness_yeomans",
"Adverb_Limiter_receptiveness_yeomans",
"Disagreement_receptiveness_yeomans",
"Acknowledgement_receptiveness_yeomans",
"First_Person_Plural_receptiveness_yeomans",
"For_Me_receptiveness_yeomans",
"WH_Questions_receptiveness_yeomans",
"YesNo_Questions_receptiveness_yeomans",
"Bare_Command_receptiveness_yeomans",
"Truth_Intensifier_receptiveness_yeomans",
"Apology_receptiveness_yeomans",
"Ask_Agency_receptiveness_yeomans",
"By_The_Way_receptiveness_yeomans",
"Can_You_receptiveness_yeomans",
"Conjunction_Start_receptiveness_yeomans",
"Could_You_receptiveness_yeomans",
"Filler_Pause_receptiveness_yeomans",
"For_You_receptiveness_yeomans",
"Formal_Title_receptiveness_yeomans",
"Give_Agency_receptiveness_yeomans",
"Affirmation_receptiveness_yeomans",
"Gratitude_receptiveness_yeomans",
"Hello_receptiveness_yeomans",
"Informal_Title_receptiveness_yeomans",
"Let_Me_Know_receptiveness_yeomans",
"Swearing_receptiveness_yeomans",
"Reassurance_receptiveness_yeomans",
"Please_receptiveness_yeomans",
"Positive_Emotion_receptiveness_yeomans",
"Goodbye_receptiveness_yeomans",
"Token_count_receptiveness_yeomans"
],
"file": "./features/politeness_v2.py, ./features/politeness_v2_helper.py, ./features/keywords.py",
"level": "Chat",
Expand Down
120 changes: 60 additions & 60 deletions src/team_comm_tools/filtered_dict.json
Original file line number Diff line number Diff line change
Expand Up @@ -286,27 +286,27 @@
},
"Politeness Strategies": {
"columns": [
"please",
"please_start",
"hashedge",
"indirect_btw",
"hedges",
"factuality",
"deference",
"gratitude",
"apologizing",
"1st_person_pl",
"1st_person",
"1st_person_start",
"2nd_person",
"2nd_person_start",
"indirect_greeting",
"direct_question",
"direct_start",
"haspositive",
"hasnegative",
"subjunctive",
"indicative"
"please_politeness_convokit",
"please_start_politeness_convokit",
"hashedge_politeness_convokit",
"indirect_btw_politeness_convokit",
"hedges_politeness_convokit",
"factuality_politeness_convokit",
"deference_politeness_convokit",
"gratitude_politeness_convokit",
"apologizing_politeness_convokit",
"1st_person_pl_politeness_convokit",
"1st_person_politeness_convokit",
"1st_person_start_politeness_convokit",
"2nd_person_politeness_convokit",
"2nd_person_start_politeness_convokit",
"indirect_greeting_politeness_convokit",
"direct_question_politeness_convokit",
"direct_start_politeness_convokit",
"haspositive_politeness_convokit",
"hasnegative_politeness_convokit",
"subjunctive_politeness_convokit",
"indicative_politeness_convokit"
],
"file": "./features/politeness_features.py",
"level": "Chat",
Expand All @@ -317,45 +317,45 @@
},
"Politeness / Receptiveness Markers": {
"columns": [
"Impersonal_Pronoun",
"First_Person_Single",
"Hedges",
"Negation",
"Subjectivity",
"Negative_Emotion",
"Reasoning",
"Agreement",
"Second_Person",
"Adverb_Limiter",
"Disagreement",
"Acknowledgement",
"First_Person_Plural",
"For_Me",
"WH_Questions",
"YesNo_Questions",
"Bare_Command",
"Truth_Intensifier",
"Apology",
"Ask_Agency",
"By_The_Way",
"Can_You",
"Conjunction_Start",
"Could_You",
"Filler_Pause",
"For_You",
"Formal_Title",
"Give_Agency",
"Affirmation",
"Gratitude",
"Hello",
"Informal_Title",
"Let_Me_Know",
"Swearing",
"Reassurance",
"Please",
"Positive_Emotion",
"Goodbye",
"Token_count"
"Impersonal_Pronoun_receptiveness_yeomans",
"First_Person_Single_receptiveness_yeomans",
"Hedges_receptiveness_yeomans",
"Negation_receptiveness_yeomans",
"Subjectivity_receptiveness_yeomans",
"Negative_Emotion_receptiveness_yeomans",
"Reasoning_receptiveness_yeomans",
"Agreement_receptiveness_yeomans",
"Second_Person_receptiveness_yeomans",
"Adverb_Limiter_receptiveness_yeomans",
"Disagreement_receptiveness_yeomans",
"Acknowledgement_receptiveness_yeomans",
"First_Person_Plural_receptiveness_yeomans",
"For_Me_receptiveness_yeomans",
"WH_Questions_receptiveness_yeomans",
"YesNo_Questions_receptiveness_yeomans",
"Bare_Command_receptiveness_yeomans",
"Truth_Intensifier_receptiveness_yeomans",
"Apology_receptiveness_yeomans",
"Ask_Agency_receptiveness_yeomans",
"By_The_Way_receptiveness_yeomans",
"Can_You_receptiveness_yeomans",
"Conjunction_Start_receptiveness_yeomans",
"Could_You_receptiveness_yeomans",
"Filler_Pause_receptiveness_yeomans",
"For_You_receptiveness_yeomans",
"Formal_Title_receptiveness_yeomans",
"Give_Agency_receptiveness_yeomans",
"Affirmation_receptiveness_yeomans",
"Gratitude_receptiveness_yeomans",
"Hello_receptiveness_yeomans",
"Informal_Title_receptiveness_yeomans",
"Let_Me_Know_receptiveness_yeomans",
"Swearing_receptiveness_yeomans",
"Reassurance_receptiveness_yeomans",
"Please_receptiveness_yeomans",
"Positive_Emotion_receptiveness_yeomans",
"Goodbye_receptiveness_yeomans",
"Token_count_receptiveness_yeomans"
],
"file": "./features/politeness_v2.py, ./features/politeness_v2_helper.py, ./features/keywords.py",
"level": "Chat",
Expand Down
6 changes: 4 additions & 2 deletions src/team_comm_tools/utils/calculate_chat_level_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ def calculate_politeness_sentiment(self) -> None:
:rtype: None
"""
transformed_df = self.chat_data['message_lower_with_punc'].apply(get_politeness_strategies).apply(pd.Series)
transformed_df = transformed_df.rename(columns=lambda x: re.sub('^feature_politeness_==()','',x)[:-2].lower())
transformed_df = transformed_df.rename(columns=lambda x: re.sub('^feature_politeness_==()','', x)[:-2].lower() + "_politeness_convokit")

# Concatenate the transformed dataframe with the original dataframe
self.chat_data = pd.concat([self.chat_data, transformed_df], axis=1)
Expand All @@ -339,7 +339,9 @@ def calculate_politeness_v2(self) -> None:
:return: None
:rtype: None
"""
self.chat_data = pd.concat([self.chat_data, get_politeness_v2(self.chat_data, 'message_lower_with_punc')], axis=1)
receptiveness_df = get_politeness_v2(self.chat_data, 'message_lower_with_punc')
receptiveness_df = receptiveness_df.rename(columns=lambda x: f"{x}_receptiveness_yeomans")
self.chat_data = pd.concat([self.chat_data, receptiveness_df], axis=1)

def get_forward_flow(self) -> None:
"""
Expand Down
47 changes: 0 additions & 47 deletions tests/data/cleaned_data/help.ipynb

This file was deleted.

Loading

0 comments on commit b55cfc4

Please sign in to comment.