janitor

janitor
git clone https://git.prime8.dev/janitor.git
Log | Files | Refs | README | LICENSE

utils.h (2103B)


      1 /**
      2  * Copyright (c)  2022  Xiaomi Corporation (authors: Fangjun Kuang)
      3  *
      4  * See LICENSE for clarification regarding multiple authors
      5  *
      6  * Licensed under the Apache License, Version 2.0 (the "License");
      7  * you may not use this file except in compliance with the License.
      8  * You may obtain a copy of the License at
      9  *
     10  *     http://www.apache.org/licenses/LICENSE-2.0
     11  *
     12  * Unless required by applicable law or agreed to in writing, software
     13  * distributed under the License is distributed on an "AS IS" BASIS,
     14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     15  * See the License for the specific language governing permissions and
     16  * limitations under the License.
     17  */
     18 
     19 #ifndef KALDI_NATIVE_FBANK_PYTHON_CSRC_UTILS_H_
     20 #define KALDI_NATIVE_FBANK_PYTHON_CSRC_UTILS_H_
     21 
     22 #include "kaldi-native-fbank/csrc/feature-fbank.h"
     23 #include "kaldi-native-fbank/csrc/feature-mfcc.h"
     24 #include "kaldi-native-fbank/csrc/feature-window.h"
     25 #include "kaldi-native-fbank/csrc/mel-computations.h"
     26 #include "kaldi-native-fbank/csrc/whisper-feature.h"
     27 #include "kaldi-native-fbank/python/csrc/kaldi-native-fbank.h"
     28 
     29 /*
     30  * This file contains code about `from_dict` and
     31  * `as_dict` for various options in kaldi-native-fbank.
     32  *
     33  * Regarding `from_dict`, users don't need to provide
     34  * all the fields in the options. If some fields
     35  * are not provided, it just uses the default one.
     36  *
     37  * If the provided dict in `from_dict` is empty,
     38  * all fields use their default values.
     39  */
     40 
     41 namespace knf {
     42 
     43 FrameExtractionOptions FrameExtractionOptionsFromDict(py::dict dict);
     44 py::dict AsDict(const FrameExtractionOptions &opts);
     45 
     46 MelBanksOptions MelBanksOptionsFromDict(py::dict dict);
     47 py::dict AsDict(const MelBanksOptions &opts);
     48 
     49 FbankOptions FbankOptionsFromDict(py::dict dict);
     50 py::dict AsDict(const FbankOptions &opts);
     51 
     52 MfccOptions MfccOptionsFromDict(py::dict dict);
     53 py::dict AsDict(const MfccOptions &opts);
     54 
     55 WhisperFeatureOptions WhisperFeatureOptionsFromDict(py::dict dict);
     56 py::dict AsDict(const WhisperFeatureOptions &opts);
     57 
     58 }  // namespace knf
     59 
     60 #endif  // KALDI_NATIVE_FBANK_PYTHON_CSRC_UTILS_H_