Skip to content

Commit

Permalink
corrected annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
Vivitsa Shankar authored and Vivitsa Shankar committed Jan 4, 2024
1 parent 913c025 commit 9e6b32c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
8 changes: 4 additions & 4 deletions dialogy/plugins/text/dob_plugin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ def get_transcripts_from_utterances(utterances: List[Utterance], func_transcript
output:
best_transcript,
"""
result_dict = {}
result_dict: Dict[str, float] = {}
result: str = ""
for utterance_set in utterances:
for utterance in utterance_set:
transcript = utterance.get('transcript')
Expand All @@ -139,7 +140,7 @@ def get_transcripts_from_utterances(utterances: List[Utterance], func_transcript
result_dict[result] = confidence

# Sort the result_dict based on confidence in descending order
sorted_result = {k: v for k, v in sorted(result_dict.items(), key=lambda item: item[1], reverse=True)}
sorted_result: Dict[str, float] = {k: v for k, v in sorted(result_dict.items(), key=lambda item: item[1], reverse=True)}
transcripts = sorted(sorted_result, key=lambda x: sorted_result[x], reverse=True)

return transcripts
Expand Down Expand Up @@ -185,8 +186,7 @@ def __init__(
**kwargs
)

async def utility(self, input: Input, _: Output) -> Any:
# return input.best_transcript
async def utility(self, input: Input, _: Output) -> List[str]:
return get_dob(input.utterances)

async def transform(self, training_data: pd.DataFrame) -> pd.DataFrame:
Expand Down
7 changes: 1 addition & 6 deletions tests/plugin/text/test_dob_plugin/test_dob_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,7 @@
get_dob = DOBPlugin(
dest="input.transcripts", use_transform=True, input_column="data"
)
"""
Checker function in test:
input: expected, all transcripts
Description: for each transcript, check if duckling(transcript)==duckling(expected)
Output: true/false, %increase in correctness
"""

def checker(transcripts: List[str], expected: str) -> Union[int, None]:
"""
input: transcripts- a list of strings; expected- a string
Expand Down

0 comments on commit 9e6b32c

Please sign in to comment.