游雁
2023-10-19 b9bcf1f093c3053fdc4e2cf4a1d38e27bbf429fb
funasr/runtime/onnxruntime/src/vocab.cpp
@@ -75,6 +75,21 @@
    return false;
}
string Vocab::WordFormat(std::string word)
{
    if(word == "i"){
        return "I";
    }else if(word == "i'm"){
        return "I'm";
    }else if(word == "i've"){
        return "I've";
    }else if(word == "i'll"){
        return "I'll";
    }else{
        return word;
    }
}
string Vocab::Vector2StringV2(vector<int> in, std::string language)
{
    int i;
@@ -94,6 +109,7 @@
            size_t found = word.find(unicodeChar);
            if(found != std::string::npos){
                if (combine != ""){
                    combine = WordFormat(combine);
                    if (words.size() != 0){
                        combine = " " + combine;
                    }
@@ -163,6 +179,14 @@
        }
    }
    if (language == "en-bpe" and combine != ""){
        combine = WordFormat(combine);
        if (words.size() != 0){
            combine = " " + combine;
        }
        words.push_back(combine);
    }
    stringstream ss;
    for (auto it = words.begin(); it != words.end(); it++) {
        ss << *it;