Skip to content

Commit

Permalink
linters
Browse files Browse the repository at this point in the history
  • Loading branch information
Tiendil committed Aug 9, 2024
1 parent c693a49 commit cba9d64
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
3 changes: 2 additions & 1 deletion ffun/ffun/librarian/processors/openai_general.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@


system = """\
You are an expert on semantic analysis, text summarization, and information extraction with PhD in Ontology-Driven Information Extraction.
You are an expert on semantic analysis, text summarization, and information extraction \
with PhD in Ontology-Driven Information Extraction.
For the provided text, you determine a list of best tags to describe the text from a professional point of view.
For each category, you provide 15 tags.
Expand Down
9 changes: 4 additions & 5 deletions ffun/ffun/processors_quality/domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def diff_processor_results(kb: KnowlegeBase, processor_name: str, entry_ids: lis
return diffs


def display_diffs(diffs: list[ProcessorResultDiff], show_tag_diffs: bool) -> None:
def display_diffs(diffs: list[ProcessorResultDiff], show_tag_diffs: bool) -> None: # noqa: CCR001
table = []

if not show_tag_diffs:
Expand Down Expand Up @@ -111,7 +111,6 @@ def display_diffs(diffs: list[ProcessorResultDiff], show_tag_diffs: bool) -> Non
must_have = "ok"
elif diff.actual_must_have_found > diff.last_must_have_found:
must_have = ", ".join(f"?{tag}" for tag in diff.last_must_have_missing)
# must_have = f'missing: {diff.last_must_have_missing}'
missing_must_have += 1
else:
raise NotImplementedError("We should not reach this point")
Expand Down Expand Up @@ -153,9 +152,9 @@ def display_diffs(diffs: list[ProcessorResultDiff], show_tag_diffs: bool) -> Non

sys.stdout.write("should diffs:\n")

sys.stdout.write(
f"worst: {should_diffs[0]:.2%}, median: {should_diffs[len(should_diffs) // 2]:.2%}, best: {should_diffs[-1]:.2%}\n"
)
should_median = should_diffs[len(should_diffs) // 2]

sys.stdout.write(f"worst: {should_diffs[0]:.2%}, median: {should_median:.2%}, best: {should_diffs[-1]:.2%}\n")

should_diff_average = sum(should_diffs) / len(should_diffs)

Expand Down
8 changes: 4 additions & 4 deletions ffun/ffun/processors_quality/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,20 @@ class ProcessorResultDiff(BaseEntity):

@pydantic.field_validator("actual_must_have_missing")
@classmethod
def sort_actual_must_have_missing_tags(cls, v: str) -> str:
def sort_actual_must_have_missing_tags(cls, v: list[str]) -> list[str]:
return list(sorted(v))

@pydantic.field_validator("last_must_have_missing")
@classmethod
def sort_last_must_have_missing_tags(cls, v: str) -> str:
def sort_last_must_have_missing_tags(cls, v: list[str]) -> list[str]:
return list(sorted(v))

@pydantic.field_validator("actual_has_and_last_not")
@classmethod
def sort_actual_has_and_last_not_tags(cls, v: str) -> str:
def sort_actual_has_and_last_not_tags(cls, v: list[str]) -> list[str]:
return list(sorted(v))

@pydantic.field_validator("last_has_and_actual_not")
@classmethod
def sort_last_has_and_actual_not_tags(cls, v: str) -> str:
def sort_last_has_and_actual_not_tags(cls, v: list[str]) -> list[str]:
return list(sorted(v))

0 comments on commit cba9d64

Please sign in to comment.