Skip to content

Use BleuScore TypeDict for BLEU score - #1365

Merged
bact merged 1 commit into
PyThaiNLP:devfrom
bact:bleuscore-type
Mar 24, 2026
Merged

Use BleuScore TypeDict for BLEU score#1365
bact merged 1 commit into
PyThaiNLP:devfrom
bact:bleuscore-type

Conversation

@bact

@bact bact commented Mar 24, 2026

Copy link
Copy Markdown
Member

What do these changes do

Introduce BleuScore class for BLEU score

class BleuScore(TypedDict):
    """BLEU score"""

    bleu: float  # BLEU score as a percentage (0.0 to 100.0)
    precisions: list[float]
    bp: float
    length_ratio: float
    hyp_length: int
    ref_length: int

What was wrong

blue_score function returns untyped dict.

Your checklist for this pull request

  • Passed code styles and structures
  • Passed code linting checks and unit test

@bact bact added this to the 5.3.3 milestone Mar 24, 2026
@bact bact added this to PyThaiNLP Mar 24, 2026
@bact bact added refactoring a technical improvement which does not add any new features or change existing features. tests Unit test, code coverage, test case labels Mar 24, 2026
@sonarqubecloud

Copy link
Copy Markdown

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 66.598% (+0.02%) from 66.574%
when pulling fc118dc on bact:bleuscore-type
into 1110c48 on PyThaiNLP:dev.

@bact
bact merged commit 56567c1 into PyThaiNLP:dev Mar 24, 2026
27 checks passed
@bact
bact deleted the bleuscore-type branch March 24, 2026 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactoring a technical improvement which does not add any new features or change existing features. tests Unit test, code coverage, test case

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants