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

TypeError due to accidental overwrite of internal dictionary #59

Closed
Tracked by #62
chrisbrickhouse opened this issue Aug 18, 2022 · 0 comments
Closed
Tracked by #62
Milestone

Comments

@chrisbrickhouse
Copy link
Collaborator

Lines 216-219 in fave/cmudictionary.py

                    if word not in add_dict:
                        add_dict = []
                    if t not in add_dict[word]:
                        add_dict[word].append(t)

The code path in line 217 resets add_dict (a dictionary) to an empty list. This leads to a problem on line 218 where add_dict is accessed as a dictionary which raises an error because it is now a list after the execution of line 217.

chrisbrickhouse pushed a commit to chrisbrickhouse/FAVE that referenced this issue Aug 18, 2022
An error in cmudictionary.py caused add_dict to be overwritten and
change type when a transcribed word was not in the cmu dictionary and
had not yet been added to the output dictionary. This led to an obvious
type error and a not obvious failure to add custom dictionaries. This
commit fixes the issue by adding the given word as a key to add_dict
and adds a test to prevent regressions.

Resolves JoFrhwld#59
chrisbrickhouse pushed a commit to chrisbrickhouse/FAVE that referenced this issue Aug 23, 2022
An error in cmudictionary.py caused add_dict to be overwritten and
change type when a transcribed word was not in the cmu dictionary and
had not yet been added to the output dictionary. This led to an obvious
type error and a not obvious failure to add custom dictionaries. This
commit fixes the issue by adding the given word as a key to add_dict
and adds a test to prevent regressions.

Resolves JoFrhwld#59
chrisbrickhouse added a commit to chrisbrickhouse/FAVE that referenced this issue Aug 23, 2022
commit 6bc72a4
Author: Christian Brickhouse <brickhouse@stanford.edu>
Date:   Wed Aug 17 23:10:36 2022 -0700

    Update deps, expand author info in toml

commit 694ba50
Author: Christian Brickhouse <brickhouse@stanford.edu>
Date:   Wed Aug 17 23:09:34 2022 -0700

    Bump version to 2.0.2-dev

commit 716f95e
Author: Christian Brickhouse <brickhouse@stanforf.edu>
Date:   Wed Aug 17 22:43:25 2022 -0700

    Fix unintended overwrite of add_dict

    An error in cmudictionary.py caused add_dict to be overwritten and
    change type when a transcribed word was not in the cmu dictionary and
    had not yet been added to the output dictionary. This led to an obvious
    type error and a not obvious failure to add custom dictionaries. This
    commit fixes the issue by adding the given word as a key to add_dict
    and adds a test to prevent regressions.

    Resolves JoFrhwld#59

commit 40503a6
Author: Christian Brickhouse <brickhouse@stanforf.edu>
Date:   Wed Aug 17 22:31:34 2022 -0700

    Add cmu_dict... test and fix write error

    This commit adds some testing for the cmudictionary.py module.

    In testing cmudictionary.CMU_Dictionary.add_dictionary_entries()
    a bug was uncovered in .check_transcription() which caused the
    output file to have more spaces than necessary. The cause was that
    function did not split the phone string when it was supposed to.
    This commit fixes the error and includes the test to prevent regression.
@chrisbrickhouse chrisbrickhouse changed the title Using custom dictionaries fails TypeError due to accidental overwrite of internal dictionary Aug 29, 2022
JoFrhwld pushed a commit that referenced this issue Sep 22, 2022
An error in cmudictionary.py caused add_dict to be overwritten and
change type when a transcribed word was not in the cmu dictionary and
had not yet been added to the output dictionary. This led to an obvious
type error and a not obvious failure to add custom dictionaries. This
commit fixes the issue by adding the given word as a key to add_dict
and adds a test to prevent regressions.

Resolves #59
JoFrhwld pushed a commit that referenced this issue Sep 22, 2022
commit 6bc72a4
Author: Christian Brickhouse <brickhouse@stanford.edu>
Date:   Wed Aug 17 23:10:36 2022 -0700

    Update deps, expand author info in toml

commit 694ba50
Author: Christian Brickhouse <brickhouse@stanford.edu>
Date:   Wed Aug 17 23:09:34 2022 -0700

    Bump version to 2.0.2-dev

commit 716f95e
Author: Christian Brickhouse <brickhouse@stanforf.edu>
Date:   Wed Aug 17 22:43:25 2022 -0700

    Fix unintended overwrite of add_dict

    An error in cmudictionary.py caused add_dict to be overwritten and
    change type when a transcribed word was not in the cmu dictionary and
    had not yet been added to the output dictionary. This led to an obvious
    type error and a not obvious failure to add custom dictionaries. This
    commit fixes the issue by adding the given word as a key to add_dict
    and adds a test to prevent regressions.

    Resolves #59

commit 40503a6
Author: Christian Brickhouse <brickhouse@stanforf.edu>
Date:   Wed Aug 17 22:31:34 2022 -0700

    Add cmu_dict... test and fix write error

    This commit adds some testing for the cmudictionary.py module.

    In testing cmudictionary.CMU_Dictionary.add_dictionary_entries()
    a bug was uncovered in .check_transcription() which caused the
    output file to have more spaces than necessary. The cause was that
    function did not split the phone string when it was supposed to.
    This commit fixes the error and includes the test to prevent regression.
JoFrhwld pushed a commit that referenced this issue Sep 22, 2022
An error in cmudictionary.py caused add_dict to be overwritten and
change type when a transcribed word was not in the cmu dictionary and
had not yet been added to the output dictionary. This led to an obvious
type error and a not obvious failure to add custom dictionaries. This
commit fixes the issue by adding the given word as a key to add_dict
and adds a test to prevent regressions.

Resolves #59
JoFrhwld pushed a commit that referenced this issue Sep 22, 2022
commit 6bc72a4
Author: Christian Brickhouse <brickhouse@stanford.edu>
Date:   Wed Aug 17 23:10:36 2022 -0700

    Update deps, expand author info in toml

commit 694ba50
Author: Christian Brickhouse <brickhouse@stanford.edu>
Date:   Wed Aug 17 23:09:34 2022 -0700

    Bump version to 2.0.2-dev

commit 716f95e
Author: Christian Brickhouse <brickhouse@stanforf.edu>
Date:   Wed Aug 17 22:43:25 2022 -0700

    Fix unintended overwrite of add_dict

    An error in cmudictionary.py caused add_dict to be overwritten and
    change type when a transcribed word was not in the cmu dictionary and
    had not yet been added to the output dictionary. This led to an obvious
    type error and a not obvious failure to add custom dictionaries. This
    commit fixes the issue by adding the given word as a key to add_dict
    and adds a test to prevent regressions.

    Resolves #59

commit 40503a6
Author: Christian Brickhouse <brickhouse@stanforf.edu>
Date:   Wed Aug 17 22:31:34 2022 -0700

    Add cmu_dict... test and fix write error

    This commit adds some testing for the cmudictionary.py module.

    In testing cmudictionary.CMU_Dictionary.add_dictionary_entries()
    a bug was uncovered in .check_transcription() which caused the
    output file to have more spaces than necessary. The cause was that
    function did not split the phone string when it was supposed to.
    This commit fixes the error and includes the test to prevent regression.
@chrisbrickhouse chrisbrickhouse added this to the Version 2.1 milestone Sep 23, 2022
chrisbrickhouse added a commit to chrisbrickhouse/FAVE that referenced this issue Sep 28, 2022
* readme

* ipa column

* aeh to ae:

* working on docs

* markdown depend

* Update deps, expand author info in toml

(cherry picked from commit 6bc72a4)

* Docs: write migration guide and doc updates

Update documentation for FAVE 2:
 * Include warning for old users on reading migration guide.
 * Write migration guide with FAQ
 * Simplify TOC code
 * Add index.rst for code and usage sections of docs
 * Add sphinx-project module into conf to make doc updates easier

* Add cmu_dict... test and fix write error

This commit adds some testing for the cmudictionary.py module.

In testing cmudictionary.CMU_Dictionary.add_dictionary_entries()
a bug was uncovered in .check_transcription() which caused the
output file to have more spaces than necessary. The cause was that
function did not split the phone string when it was supposed to.
This commit fixes the error and includes the test to prevent regression.

* Fix unintended overwrite of add_dict

An error in cmudictionary.py caused add_dict to be overwritten and
change type when a transcribed word was not in the cmu dictionary and
had not yet been added to the output dictionary. This led to an obvious
type error and a not obvious failure to add custom dictionaries. This
commit fixes the issue by adding the given word as a key to add_dict
and adds a test to prevent regressions.

Resolves JoFrhwld#59

* Squashed commit of the following:

commit 6bc72a4
Author: Christian Brickhouse <brickhouse@stanford.edu>
Date:   Wed Aug 17 23:10:36 2022 -0700

    Update deps, expand author info in toml

commit 694ba50
Author: Christian Brickhouse <brickhouse@stanford.edu>
Date:   Wed Aug 17 23:09:34 2022 -0700

    Bump version to 2.0.2-dev

commit 716f95e
Author: Christian Brickhouse <brickhouse@stanforf.edu>
Date:   Wed Aug 17 22:43:25 2022 -0700

    Fix unintended overwrite of add_dict

    An error in cmudictionary.py caused add_dict to be overwritten and
    change type when a transcribed word was not in the cmu dictionary and
    had not yet been added to the output dictionary. This led to an obvious
    type error and a not obvious failure to add custom dictionaries. This
    commit fixes the issue by adding the given word as a key to add_dict
    and adds a test to prevent regressions.

    Resolves JoFrhwld#59

commit 40503a6
Author: Christian Brickhouse <brickhouse@stanforf.edu>
Date:   Wed Aug 17 22:31:34 2022 -0700

    Add cmu_dict... test and fix write error

    This commit adds some testing for the cmudictionary.py module.

    In testing cmudictionary.CMU_Dictionary.add_dictionary_entries()
    a bug was uncovered in .check_transcription() which caused the
    output file to have more spaces than necessary. The cause was that
    function did not split the phone string when it was supposed to.
    This commit fixes the error and includes the test to prevent regression.

* not appropriate to log git versions anymore

* fixing a copy-paste error from elsewhere

* fixing the tqdm pbar update

* updating

* ipa column

* aeh to ae:

* poetry lock woes

* move from rst to myst

* conversion cleanup

* Add myst-parser to docs/requirements.txt for build

The Github workflow uses the requirements.txt to figure out what
dependencies are needed for the documentation build.

Co-authored-by: Christian Brickhouse <brickhouse@stanford.edu>
Co-authored-by: Christian Brickhouse <brickhouse@stanforf.edu>
chrisbrickhouse pushed a commit to chrisbrickhouse/FAVE that referenced this issue Oct 1, 2022
An error in cmudictionary.py caused add_dict to be overwritten and
change type when a transcribed word was not in the cmu dictionary and
had not yet been added to the output dictionary. This led to an obvious
type error and a not obvious failure to add custom dictionaries. This
commit fixes the issue by adding the given word as a key to add_dict
and adds a test to prevent regressions.

Resolves JoFrhwld#59
chrisbrickhouse added a commit to chrisbrickhouse/FAVE that referenced this issue Oct 1, 2022
commit 6bc72a4
Author: Christian Brickhouse <brickhouse@stanford.edu>
Date:   Wed Aug 17 23:10:36 2022 -0700

    Update deps, expand author info in toml

commit 694ba50
Author: Christian Brickhouse <brickhouse@stanford.edu>
Date:   Wed Aug 17 23:09:34 2022 -0700

    Bump version to 2.0.2-dev

commit 716f95e
Author: Christian Brickhouse <brickhouse@stanforf.edu>
Date:   Wed Aug 17 22:43:25 2022 -0700

    Fix unintended overwrite of add_dict

    An error in cmudictionary.py caused add_dict to be overwritten and
    change type when a transcribed word was not in the cmu dictionary and
    had not yet been added to the output dictionary. This led to an obvious
    type error and a not obvious failure to add custom dictionaries. This
    commit fixes the issue by adding the given word as a key to add_dict
    and adds a test to prevent regressions.

    Resolves JoFrhwld#59

commit 40503a6
Author: Christian Brickhouse <brickhouse@stanforf.edu>
Date:   Wed Aug 17 22:31:34 2022 -0700

    Add cmu_dict... test and fix write error

    This commit adds some testing for the cmudictionary.py module.

    In testing cmudictionary.CMU_Dictionary.add_dictionary_entries()
    a bug was uncovered in .check_transcription() which caused the
    output file to have more spaces than necessary. The cause was that
    function did not split the phone string when it was supposed to.
    This commit fixes the error and includes the test to prevent regression.
chrisbrickhouse added a commit to chrisbrickhouse/FAVE that referenced this issue Oct 10, 2022
squashed commit of:

ipa column

aeh to ae:

working on docs

markdown depend

ipa column

aeh to ae:

poetry lock woes

move from rst to myst

conversion cleanup

Add myst-parser to docs/requirements.txt for build

The Github workflow uses the requirements.txt to figure out what
dependencies are needed for the documentation build.

Migrate documentation from ReStructured Text to MarkDown (#1)

* readme

* ipa column

* aeh to ae:

* working on docs

* markdown depend

* Update deps, expand author info in toml

(cherry picked from commit 6bc72a4)

* Docs: write migration guide and doc updates

Update documentation for FAVE 2:
 * Include warning for old users on reading migration guide.
 * Write migration guide with FAQ
 * Simplify TOC code
 * Add index.rst for code and usage sections of docs
 * Add sphinx-project module into conf to make doc updates easier

* Add cmu_dict... test and fix write error

This commit adds some testing for the cmudictionary.py module.

In testing cmudictionary.CMU_Dictionary.add_dictionary_entries()
a bug was uncovered in .check_transcription() which caused the
output file to have more spaces than necessary. The cause was that
function did not split the phone string when it was supposed to.
This commit fixes the error and includes the test to prevent regression.

* Fix unintended overwrite of add_dict

An error in cmudictionary.py caused add_dict to be overwritten and
change type when a transcribed word was not in the cmu dictionary and
had not yet been added to the output dictionary. This led to an obvious
type error and a not obvious failure to add custom dictionaries. This
commit fixes the issue by adding the given word as a key to add_dict
and adds a test to prevent regressions.

Resolves JoFrhwld#59

* Squashed commit of the following:

commit 6bc72a4
Author: Christian Brickhouse <brickhouse@stanford.edu>
Date:   Wed Aug 17 23:10:36 2022 -0700

    Update deps, expand author info in toml

commit 694ba50
Author: Christian Brickhouse <brickhouse@stanford.edu>
Date:   Wed Aug 17 23:09:34 2022 -0700

    Bump version to 2.0.2-dev

commit 716f95e
Author: Christian Brickhouse <brickhouse@stanforf.edu>
Date:   Wed Aug 17 22:43:25 2022 -0700

    Fix unintended overwrite of add_dict

    An error in cmudictionary.py caused add_dict to be overwritten and
    change type when a transcribed word was not in the cmu dictionary and
    had not yet been added to the output dictionary. This led to an obvious
    type error and a not obvious failure to add custom dictionaries. This
    commit fixes the issue by adding the given word as a key to add_dict
    and adds a test to prevent regressions.

    Resolves JoFrhwld#59

commit 40503a6
Author: Christian Brickhouse <brickhouse@stanforf.edu>
Date:   Wed Aug 17 22:31:34 2022 -0700

    Add cmu_dict... test and fix write error

    This commit adds some testing for the cmudictionary.py module.

    In testing cmudictionary.CMU_Dictionary.add_dictionary_entries()
    a bug was uncovered in .check_transcription() which caused the
    output file to have more spaces than necessary. The cause was that
    function did not split the phone string when it was supposed to.
    This commit fixes the error and includes the test to prevent regression.

* not appropriate to log git versions anymore

* fixing a copy-paste error from elsewhere

* fixing the tqdm pbar update

* updating

* ipa column

* aeh to ae:

* poetry lock woes

* move from rst to myst

* conversion cleanup

* Add myst-parser to docs/requirements.txt for build

The Github workflow uses the requirements.txt to figure out what
dependencies are needed for the documentation build.

Co-authored-by: Christian Brickhouse <brickhouse@stanford.edu>
Co-authored-by: Christian Brickhouse <brickhouse@stanforf.edu>

Update deps, expand author info in toml
chrisbrickhouse added a commit to chrisbrickhouse/FAVE that referenced this issue Oct 10, 2022
squashed commit of:

ipa column

aeh to ae:

working on docs

markdown depend

ipa column

aeh to ae:

poetry lock woes

move from rst to myst

conversion cleanup

Add myst-parser to docs/requirements.txt for build

The Github workflow uses the requirements.txt to figure out what
dependencies are needed for the documentation build.

Migrate documentation from ReStructured Text to MarkDown (#1)

* readme

* ipa column

* aeh to ae:

* working on docs

* markdown depend

* Update deps, expand author info in toml

(cherry picked from commit 6bc72a4)

* Docs: write migration guide and doc updates

Update documentation for FAVE 2:
 * Include warning for old users on reading migration guide.
 * Write migration guide with FAQ
 * Simplify TOC code
 * Add index.rst for code and usage sections of docs
 * Add sphinx-project module into conf to make doc updates easier

* Add cmu_dict... test and fix write error

This commit adds some testing for the cmudictionary.py module.

In testing cmudictionary.CMU_Dictionary.add_dictionary_entries()
a bug was uncovered in .check_transcription() which caused the
output file to have more spaces than necessary. The cause was that
function did not split the phone string when it was supposed to.
This commit fixes the error and includes the test to prevent regression.

* Fix unintended overwrite of add_dict

An error in cmudictionary.py caused add_dict to be overwritten and
change type when a transcribed word was not in the cmu dictionary and
had not yet been added to the output dictionary. This led to an obvious
type error and a not obvious failure to add custom dictionaries. This
commit fixes the issue by adding the given word as a key to add_dict
and adds a test to prevent regressions.

Resolves JoFrhwld#59

* Squashed commit of the following:

commit 6bc72a4
Author: Christian Brickhouse <brickhouse@stanford.edu>
Date:   Wed Aug 17 23:10:36 2022 -0700

    Update deps, expand author info in toml

commit 694ba50
Author: Christian Brickhouse <brickhouse@stanford.edu>
Date:   Wed Aug 17 23:09:34 2022 -0700

    Bump version to 2.0.2-dev

commit 716f95e
Author: Christian Brickhouse <brickhouse@stanforf.edu>
Date:   Wed Aug 17 22:43:25 2022 -0700

    Fix unintended overwrite of add_dict

    An error in cmudictionary.py caused add_dict to be overwritten and
    change type when a transcribed word was not in the cmu dictionary and
    had not yet been added to the output dictionary. This led to an obvious
    type error and a not obvious failure to add custom dictionaries. This
    commit fixes the issue by adding the given word as a key to add_dict
    and adds a test to prevent regressions.

    Resolves JoFrhwld#59

commit 40503a6
Author: Christian Brickhouse <brickhouse@stanforf.edu>
Date:   Wed Aug 17 22:31:34 2022 -0700

    Add cmu_dict... test and fix write error

    This commit adds some testing for the cmudictionary.py module.

    In testing cmudictionary.CMU_Dictionary.add_dictionary_entries()
    a bug was uncovered in .check_transcription() which caused the
    output file to have more spaces than necessary. The cause was that
    function did not split the phone string when it was supposed to.
    This commit fixes the error and includes the test to prevent regression.

* not appropriate to log git versions anymore

* fixing a copy-paste error from elsewhere

* fixing the tqdm pbar update

* updating

* ipa column

* aeh to ae:

* poetry lock woes

* move from rst to myst

* conversion cleanup

* Add myst-parser to docs/requirements.txt for build

The Github workflow uses the requirements.txt to figure out what
dependencies are needed for the documentation build.

Co-authored-by: Christian Brickhouse <brickhouse@stanford.edu>
Co-authored-by: Christian Brickhouse <brickhouse@stanforf.edu>

Update deps, expand author info in toml
chrisbrickhouse pushed a commit to chrisbrickhouse/FAVE that referenced this issue Mar 13, 2024
An error in cmudictionary.py caused add_dict to be overwritten and
change type when a transcribed word was not in the cmu dictionary and
had not yet been added to the output dictionary. This led to an obvious
type error and a not obvious failure to add custom dictionaries. This
commit fixes the issue by adding the given word as a key to add_dict
and adds a test to prevent regressions.

Resolves JoFrhwld#59
chrisbrickhouse pushed a commit that referenced this issue Mar 29, 2024
An error in cmudictionary.py caused add_dict to be overwritten and
change type when a transcribed word was not in the cmu dictionary and
had not yet been added to the output dictionary. This led to an obvious
type error and a not obvious failure to add custom dictionaries. This
commit fixes the issue by adding the given word as a key to add_dict
and adds a test to prevent regressions.

Resolves #59
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

No branches or pull requests

1 participant