Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed off-by-one errors in _create_word_graph #77

Merged
merged 2 commits into from
Dec 1, 2023

Conversation

isaac091
Copy link
Collaborator

@isaac091 isaac091 commented Nov 30, 2023

The source_start_index and source_end_index of WordGraphArcs seem to be 1-indexed, which was leading to index out of range errors.


This change is Reviewable

@isaac091 isaac091 requested a review from ddaspit November 30, 2023 22:48
Copy link
Contributor

@ddaspit ddaspit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch.

Please add the following unit tests to test_thot_smt_model.py:

def test_get_word_graph_hmm() -> None:
    with _create_hmm_model() as smt_model:
        word_graph = smt_model.get_word_graph("voy a marcharme hoy por la tarde .")
        assert len(word_graph.arcs) == 2
        assert len(word_graph.final_states) == 1


def test_get_word_graph_fast_align() -> None:
    with _create_fast_align_model() as smt_model:
        word_graph = smt_model.get_word_graph("voy a marcharme hoy por la tarde .")
        assert len(word_graph.arcs) == 2
        assert len(word_graph.final_states) == 1

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @isaac091)

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (96a6786) 86.74% compared to head (c67806b) 86.84%.
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #77      +/-   ##
==========================================
+ Coverage   86.74%   86.84%   +0.09%     
==========================================
  Files         226      226              
  Lines       13596    13606      +10     
==========================================
+ Hits        11794    11816      +22     
+ Misses       1802     1790      -12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@johnml1135 johnml1135 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @isaac091)

@johnml1135 johnml1135 merged commit 644f256 into main Dec 1, 2023
@isaac091 isaac091 deleted the create_word_graph_bug branch December 1, 2023 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants