EveryVoiceTTS / EveryVoiceTTS/EveryVoice
Custom g2p validation should allow duck typing
- Dominant language
- Python
- Stars
- 45
- Forks
- 4
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 14
Description
### Description & Motivation
Currently, this custom g2p function is accepted:
```
def my_g2p(a: str) -> List[str]:
return a.split()
```
But this functionally identical one is not:
```
def my_g2p(a):
return a.split()
```
It's a nice idea to check the signature, but if someone uses an existing library where the g2p function exists but is not annotated, right now we're forcing them to create and install a new module or maybe modify their existing module, just to add typing.
So the validation should based on something like `my_g2p("test string")` returning a list of strings, or possibly even a n `Iterable[str]`, which we can test by doing something like
```
result = my_g2p("test string")
assert not isinstance(result, str) and all(isinstance(x, str) for x in list(result))
```
Where I'm going here is the most narrowly targeted duck typing test, where I'm just asserting what we actually use.
For this variant, we might have to change how we use the custom g2p functions and explicitly pass their return value to the list constructor, so that what we store is an actual list of strings.
Contributor guide
Research direction
No file or test is named in the issue. Start by locating the validation and call sites for custom g2p functions, then inspect how their return values are stored. Done means unannotated callables are accepted when they return an iterable of strings, while stored results remain lists of strings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100