add private module to create model object for speech api

This commit is contained in:
jordi.hasianta
2022-09-15 19:47:27 +07:00
parent aeb4a53a2f
commit 2ec99681f0
3 changed files with 51 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
import tempfile
from opendbm.api_lib.model import OPENDBM_DATA, AudioModel
from opendbm.dbm_lib import run_speech_feature
class SpeechFeature(AudioModel):
def __init__(self):
super().__init__()
self._params = [
"nlp_numSentences",
"nlp_singPronPerAns",
"nlp_singPronPerSen",
"nlp_pastTensePerAns",
"nlp_pastTensePerSen",
"nlp_pronounsPerAns",
"nlp_pronounsPerSen",
"nlp_verbsPerAns",
"nlp_verbsPerSen",
"nlp_adjectivesPerAns",
"nlp_adjectivesPerSen",
"nlp_nounsPerAns",
"nlp_nounsPerSen",
"nlp_sentiment_mean",
"nlp_mattr",
"nlp_wordsPerMin",
"nlp_totalTime",
]
@AudioModel.prep_func
def _fit_transform(self, path):
return run_speech_feature(
path, f"{tempfile.gettempdir()}/", self.r_config, OPENDBM_DATA, save=False
)