Closed phamkhactu closed 1 year ago
You can pipe "hello" to mfa g2p
using '-' instead of input paths: https://montreal-forced-aligner.readthedocs.io/en/latest/user_guide/workflows/dictionary_generating.html#piping-stdin-stdout
So this would be a command like mfa g2p - english_us_mfa -
and if you pipe in hello
it will pipe out hello h ə l oʊ
. That's probably the easiest route (or using subprocess in python code), but you could also do something like
from montreal_forced_aligner.g2p.generator import (
PyniniConsoleGenerator
)
g2p_model_path = "/path/to/g2p_model.zip"
g2p = PyniniConsoleGenerator(
g2p_model_path=g2p_model_path
)
word ="Hello"
pronunciations = g2p.rewriter(word)
print(pronunciations[0].split()) # Should print ['h', 'ə', 'l', 'oʊ']
You can pipe "hello" to
mfa g2p
using '-' instead of input paths: https://montreal-forced-aligner.readthedocs.io/en/latest/user_guide/workflows/dictionary_generating.html#piping-stdin-stdoutSo this would be a command like
mfa g2p - english_us_mfa -
and if you pipe inhello
it will pipe outhello h ə l oʊ
. That's probably the easiest route (or using subprocess in python code), but you could also do something likefrom montreal_forced_aligner.g2p.generator import ( PyniniConsoleGenerator ) g2p_model_path = "/path/to/g2p_model.zip" g2p = PyniniConsoleGenerator( g2p_model_path=g2p_model_path ) word ="Hello" pronunciations = g2p.rewriter(word) print(pronunciations[0].split()) # Should print ['h', 'ə', 'l', 'oʊ']
I update the source code for more correctly when calling with python
That we must call g2p setup before infer the model: https://github.com/MontrealCorpusTools/Montreal-Forced-Aligner/blob/e08da3b843bc34b10224bef49c98e47ade6339c0/montreal_forced_aligner/g2p/generator.py#L510
from montreal_forced_aligner.g2p.generator import (
PyniniConsoleGenerator
)
g2p_model_path = "/path/to/g2p_model.zip"
g2p = PyniniConsoleGenerator(
g2p_model_path=g2p_model_path
)
g2p.setup()
word ="Hello"
pronunciations = g2p.rewriter(word)
print(pronunciations[0].split()) # Should print ['h', 'ə', 'l', 'oʊ']
First of all, I would like to said that: Thanks for your excellent repo.
I want to get phoneme from my models that I've trained with input text For example my pseudo:
Could you guide me for doing that. Many thanks