当前位置: 首页>>代码示例>>C++>>正文


C++ CFSArray::AddItem方法代码示例

本文整理汇总了C++中CFSArray::AddItem方法的典型用法代码示例。如果您正苦于以下问题:C++ CFSArray::AddItem方法的具体用法?C++ CFSArray::AddItem怎么用?C++ CFSArray::AddItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CFSArray的用法示例。


在下文中一共展示了CFSArray::AddItem方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: do_phones

void do_phones(syl_struct &ss) {
    CFSArray<phone_struct> pv;
    phone_struct p;
    p.utt_p = 0;
    p.phr_p = 0;
    p.word_p = 0;
    p.syl_p = 0;
    INTPTR phone_syl_p = 1;
    for (INTPTR i = 0; i < ss.syl.GetLength(); i++) {
        CFSWString c = ss.syl.GetAt(i);
        if ((c == L'š') || (c == L'ž')) c = L"sh";
        if (c == L'õ') c = L"q";
        if (c == L'ä') c = L"x";
        if (c == L'ö') c = L"c";
        if (c == L'ü') c = L"y";

        if (is_colon(c)) {
            // 1. nihutusvigade kaitseks (vt "piirkonda")
            // 2-3. kolmandas vältes v ja j on kõnebaasis sedavõrd haruldased,
            // et väljundis kuuleb nende asemel mingit r-i laadset hääikut.
            // Kellel on parem baas, kommenteerigu 2. ja 3. tingimus välja.            
				if ((i > 0) && (pv[pv.GetSize() - 1].phone != L"j") && (pv[pv.GetSize() - 1].phone != L"v"))
                pv[pv.GetSize() - 1].phone += doq;
        } else {
            p.phone = c;
            p.syl_p = phone_syl_p++;
            pv.AddItem(p);
        }

    }
    ss.phone_vector = pv;
}
开发者ID:ikiissel,项目名称:synthts_et,代码行数:32,代码来源:mklab.cpp

示例2: addAnalysis

// add morphological analysis to CFSArray containing the sentence
void addAnalysis(CLinguistic& linguistic, CDisambiguator& disambiguator, CFSArray<CFSVar>& words, const bool disambiguate) {
    //CFSVar &words=Data["words"];
    CFSArray<CPTWord> PTWords;
    for (INTPTR ip=0; ip<words.GetSize(); ip++) {
        PTWords.AddItem(words[ip]["text"].GetWString());
    }
    // perform analysis and optional disambiguation
    CFSArray<CMorphInfos> MorphResults=linguistic.AnalyzeSentense(PTWords);
    if (disambiguate) {
        MorphResults=disambiguator.Disambiguate(MorphResults);
    }
    // collect the analysis results
    ASSERT(PTWords.GetSize()==MorphResults.GetSize());
    for (INTPTR ip=0; ip<words.GetSize(); ip++) {
        const CFSArray<CMorphInfo> &Analysis=MorphResults[ip].m_MorphInfo;
        CFSVar VarAnalysis;
        VarAnalysis.Cast(CFSVar::VAR_ARRAY);
        for (INTPTR ipRes=0; ipRes<Analysis.GetSize(); ipRes++) {
            const CMorphInfo &Analysis1=Analysis[ipRes];
            CFSVar VarAnalysis1;
            VarAnalysis1["root"]=Analysis1.m_szRoot;
            VarAnalysis1["ending"]=Analysis1.m_szEnding;
            VarAnalysis1["clitic"]=Analysis1.m_szClitic;
            VarAnalysis1["partofspeech"]=CFSWString(Analysis1.m_cPOS);
            VarAnalysis1["form"]=Analysis1.m_szForm;
            VarAnalysis[ipRes]=VarAnalysis1;
        }
        words[ip]["analysis"]=VarAnalysis;
    }
}
开发者ID:urdvr,项目名称:estnltk,代码行数:31,代码来源:vabamorf.cpp

示例3: phrase2words

void phrase2words(phrase_struct &p, CFSArray<CPTWord> &PTW) {

    CFSWString res;
    CFSArray<CPTWord> PTWords;
    CFSArray<CFSWString> word_array;

    for (INTPTR i = 0; i < p.s.GetLength(); i++) {
        CFSWString c = p.s.GetAt(i);
        if (is_space(c) || i == (p.s.GetLength() - 1)) {
            if (i == (p.s.GetLength() - 1)) res += c;
            word_array.AddItem(res);
            res = empty_str;
        } else res += c;
    }

    word_array = tokens2words(word_array);
    p.s = empty_str;

    for (INTPTR i = 0; i < word_array.GetSize(); i++) {
        p.s += word_array[i];
        if (i < word_array.GetSize() - 1) p.s += sp;
        PTW.AddItem(word_array[i]); //.ToLower()); Kui väiketähtedeks, siis siin
    }
    p.word_c = word_array.GetSize();
}
开发者ID:ikiissel,项目名称:synthts_et,代码行数:25,代码来源:mklab.cpp

示例4: do_phones

void do_phones(syl_struct &ss) {
    CFSArray<phone_struct> pv;
    phone_struct p;
    p.utt_p = 0;
    p.phr_p = 0;
    p.word_p = 0;
    p.syl_p = 0;
    INTPTR phone_syl_p = 1;
    
    for (INTPTR i = 0; i < ss.syl.GetLength(); i++) {
        CFSWString c = ss.syl.GetAt(i);        
        if ((c == L'š') || (c == L'ž')) c = L"sh";
        else
        if (c == L'q') c = L"kw";
        else
        if (c == L'õ') c = L"q";
        else
        if (c == L'ä') c = L"x";
        else
        if (c == L'ö') c = L"c";
        else
        if (c == L'ü') c = L"y";

        if (is_colon(c)) {
            if (i > 0) // nihutusvigade kaitseks (vt "piirkonda")
                pv[pv.GetSize() - 1].phone += doq;
        } else {
            p.phone = c;
            p.syl_p = phone_syl_p++;
            pv.AddItem(p);
        }

    }
    ss.phone_vector = pv;
}
开发者ID:ikiissel,项目名称:synthts_vr,代码行数:35,代码来源:mklab.cpp

示例5: convertDisambInput

CFSArray<CMorphInfos> convertDisambInput(std::vector<WordAnalysis> const& words) {
    CFSArray<CMorphInfos> infosarray;
    const int n = words.size();
    for (int i=0 ; i<n ; ++i) {
        WordAnalysis const& word = words[i];
        infosarray.AddItem(convertWordAnalysis(word));
    }
    return infosarray;
}
开发者ID:urdvr,项目名称:estnltk,代码行数:9,代码来源:vabamorf.cpp

示例6: MorphInfosToJNI

JNIEXPORT jobjectArray JNICALL Java_ee_filosoft_vabamorf_Linguistic_analyzeSentence(JNIEnv *env, jobject jobj, jobjectArray words)
{
	FUNCTION_HEADER;
	if (!linguistic) return NULL;

	try {
		CFSArray<CPTWord> ptwords;
		INTPTR ipSize = env->GetArrayLength(words);
		for (INTPTR ip=0; ip<ipSize; ip++) {
			ptwords.AddItem(FSJNIStrtoW(env, (jstring)env->GetObjectArrayElement(words, ip)));
		}

		CFSArray<CMorphInfos> results = linguistic->AnalyzeSentence(ptwords);

		jobjectArray analyzes = (jobjectArray)env->NewObjectArray(results.GetSize(), env->FindClass("java/lang/Object"), 0);
		for (INTPTR ip = 0; ip < results.GetSize(); ip++) {
			env->SetObjectArrayElement(analyzes, ip, MorphInfosToJNI(env, results[ip]));
		}
		return analyzes;
	} catch(...) {
		return NULL;
	}
}
开发者ID:Filosoft,项目名称:vabamorf,代码行数:23,代码来源:linguistic_jni.cpp

示例7: catch

JNIEXPORT jintArray JNICALL Java_ee_filosoft_vabamorf_Linguistic_spellWords(JNIEnv *env, jobject jobj, jobjectArray words)
{
	FUNCTION_HEADER;
	if (!linguistic) return NULL;

	try {
		CFSArray<CPTWord> ptwords;
		INTPTR ipSize = env->GetArrayLength(words);
		for (INTPTR ip=0; ip<ipSize; ip++) {
			ptwords.AddItem(FSJNIStrtoW(env, (jstring)env->GetObjectArrayElement(words, ip)));
		}

		CFSArray<SPLRESULT> splresults = linguistic->SpellWords(ptwords);

		jintArray result = env->NewIntArray(splresults.GetSize());
		for (INTPTR ip=0; ip<splresults.GetSize(); ip++) {
			jint result1 = splresults[ip];
			env->SetIntArrayRegion(result, ip, 1, &result1);
		}
		return result;
	} catch (...) {
		return NULL;
	}
}
开发者ID:Filosoft,项目名称:vabamorf,代码行数:24,代码来源:linguistic_jni.cpp

示例8: ctype

CFSArray<CFSWString> tokens2words(CFSArray<CFSWString> a) {
    CFSArray<CFSWString> temp_array;
    CFSArray<CFSWString> res;
    for (INTPTR i = 0; i < a.GetSize(); i++) {
        CFSWString s = a[i];

        if (is_abbreviation(s, temp_array) > 0) {
            for (INTPTR i = 0; i < temp_array.GetSize(); i++)
                res.AddItem(temp_array[i]);
        } else
            if (is_word(s))
            res.AddItem(s);
        else {
            CFSArray<CFSWString> carray;
            make_ctype_array(s, carray);
            for (INTPTR ictype = 0; ictype < carray.GetSize(); ictype++) {
                INTPTR c_type = ctype(carray[ictype].GetAt(0));
                if (c_type == 1) { //Tähed
                    if (is_word(carray[ictype])) res.AddItem(carray[ictype]);
                    else { // kui on sodipodi
                        explode(carray[ictype], L"", temp_array);
                        for (INTPTR i_temp = 0; i_temp < temp_array.GetSize(); i_temp++)
                            res.AddItem(replace_schar(temp_array[i_temp]));
                    }
                } else
                    if (c_type == 2) { //Sümbolid
                    explode(carray[ictype], L"", temp_array);
                    for (INTPTR i_temp = 0; i_temp < temp_array.GetSize(); i_temp++)
                        res.AddItem(replace_schar(temp_array[i_temp]));
                } else
                    if (c_type == 3) { //Numbrid
                    CFSWString nr = int_to_words(carray[ictype]);
                    explode(nr, sp, temp_array);
                    for (INTPTR i_temp = 0; i_temp < temp_array.GetSize(); i_temp++)
                        if (temp_array[i_temp].GetLength() > 0)
                            res.AddItem(temp_array[i_temp]);
                }
            }
        }
    } // iga token

    return res;
}
开发者ID:ikiissel,项目名称:synthts_et,代码行数:43,代码来源:mklab.cpp

示例9:

CFSArray<CFSWString> do_all(CFSWString utt, bool print_label, bool print_utt) {
    CFSArray<CFSWString> res;
    CFSArray<CPTWord> PTW;
    utterance_struct u;
    u.s = utt;
    u.syl_c = 0;
    u.phone_c = 0;
    u.phra_c = do_phrases(u);
    INTPTR word_count = 0;
	 if (print_utt) fprintf(stderr, "%s\n", ccstr(utt));    
    for (INTPTR i = 0; i < u.phr_vector.GetSize(); i++) {
        u.phr_vector[i].utt_p = i;
        phrase2words(u.phr_vector[i], PTW);
        word_count += u.phr_vector[i].word_c;
    }

    CFSArray<CMorphInfos> MRs = Disambiguator.Disambiguate(Linguistic.AnalyzeSentense(PTW));

    CFSArray<CMorphInfo> words;

    for (INTPTR i = 0; i < MRs.GetSize(); i++)
        //for (INTPTR i1 = 0; i1 < MRs[i].m_MorphInfo.GetSize(); i1++)
        words.AddItem(MRs[i].m_MorphInfo[0]); //Ühestamistulemuse ühestamise koht


    u.word_c = words.GetSize();


    word_struct w;

    INTPTR utt_phone_c = 1;
    INTPTR syl_utt_p = 1;
    INTPTR phone_utt_p = 1;



    for (INTPTR i = 0; i < u.phr_vector.GetSize(); i++) {
        u.phr_vector[i].utt_p = i + 1;
        INTPTR syl_phr_p = 1;
        INTPTR phone_phr_p = 1;
        INTPTR phrase_pho_c = 1;
        for (INTPTR i1 = 0; i1 < u.phr_vector[i].word_c; i1++) {
            w.utt_p = utt_phone_c++;
            w.phr_p = i1 + 1;
            w.mi = words[0];
            w.mi.m_szRoot += make_char_string(w.mi.m_szEnding) + w.mi.m_szClitic;            
            w.mi.m_szRoot = w.mi.m_szRoot.ToLower();
            // sidesõnad + ei välteta
            if ((CFSWString(w.mi.m_cPOS) == L"J") || (w.mi.m_szRoot == L"<ei")) w.mi.m_szRoot.Replace(L"<", L"", 1);
            do_syls(w);
            u.phr_vector[i].word_vector.AddItem(w);

            INTPTR phone_word_p = 1;
            INTPTR word_pho_c = 1;
            for (INTPTR i2 = 0; i2 < u.phr_vector[i].word_vector[i1].syl_vector.GetSize(); i2++) {
                u.syl_c++;
                u.phr_vector[i].syl_c++;
                u.phr_vector[i].word_vector[i1].syl_c++;
                u.phr_vector[i].word_vector[i1].syl_vector[i2].phr_p = syl_phr_p++;
                u.phr_vector[i].word_vector[i1].syl_vector[i2].utt_p = syl_utt_p++;
                INTPTR syl_phone_c = 1;

                do_phones(u.phr_vector[i].word_vector[i1].syl_vector[i2]);

                for (INTPTR i3 = 0; i3 < u.phr_vector[i].word_vector[i1].syl_vector[i2].phone_vector.GetSize(); i3++) {
                    u.phone_c++;
                    u.phr_vector[i].phone_c = phrase_pho_c++;
                    u.phr_vector[i].word_vector[i1].phone_c = word_pho_c++;
                    u.phr_vector[i].word_vector[i1].syl_vector[i2].phone_c = syl_phone_c++;
                    phone_struct p = u.phr_vector[i].word_vector[i1].syl_vector[i2].phone_vector[i3];
                    p.utt_p = phone_utt_p++;
                    p.phr_p = phone_phr_p++;
                    p.word_p = phone_word_p++;
                    u.phr_vector[i].word_vector[i1].syl_vector[i2].phone_vector[i3] = p;

                }

            }
            words.RemoveItem(0, 1);
        }
    }




    if (print_label) print_u(u);
    res = do_label(u);
    return res;
}
开发者ID:ikiissel,项目名称:synthts_et,代码行数:89,代码来源:mklab.cpp

示例10:

CFSArray<CFSWString> do_all(CFSWString utt, bool print_label, bool print_utt) {
    CFSArray<CFSWString> res;
    CFSArray<CPTWord> PTW;
    utterance_struct u;
    

    u.s = utt.ToLower();
    u.syl_c = 0;
    u.phone_c = 0;
    u.phra_c = do_phrases(u);
    INTPTR word_count = 0;
    
    if (print_utt) fprintf(stderr, "%s\n", ccstr(utt));
       
    for (INTPTR i = 0; i < u.phr_vector.GetSize(); i++) {
        u.phr_vector[i].utt_p = i;        
        phrase2words(u.phr_vector[i], PTW);
        word_count += u.phr_vector[i].word_c;        
        
    }
    

    CFSArray<CMorphInfo> words;
    for (INTPTR i = 0; i < PTW.GetSize(); i++) {
        CMorphInfo MI;
        MI.m_szRoot = PTW[i].m_szWord;
        words.AddItem(MI);
    }
        
    
    u.word_c = words.GetSize();


    word_struct w;

    INTPTR utt_phone_c = 1;
    INTPTR syl_utt_p = 1;
    INTPTR phone_utt_p = 1;



    for (INTPTR i = 0; i < u.phr_vector.GetSize(); i++) {
        u.phr_vector[i].utt_p = i + 1;
        INTPTR syl_phr_p = 1;
        INTPTR phone_phr_p = 1;
        INTPTR phrase_pho_c = 1;
        for (INTPTR i1 = 0; i1 < u.phr_vector[i].word_c; i1++) {
            
            w.utt_p = utt_phone_c++;
            w.phr_p = i1 + 1;
            w.mi = words[0];
            w.mi.m_szRoot += make_char_string(w.mi.m_szEnding) + w.mi.m_szClitic;
            w.mi.m_szRoot = w.mi.m_szRoot.ToLower();
            do_syls(w);
            u.phr_vector[i].word_vector.AddItem(w);

            INTPTR phone_word_p = 1;
            INTPTR word_pho_c = 1;
            for (INTPTR i2 = 0; i2 < u.phr_vector[i].word_vector[i1].syl_vector.GetSize(); i2++) {
                u.syl_c++;
                u.phr_vector[i].syl_c++;
                u.phr_vector[i].word_vector[i1].syl_c++;
                u.phr_vector[i].word_vector[i1].syl_vector[i2].phr_p = syl_phr_p++;
                u.phr_vector[i].word_vector[i1].syl_vector[i2].utt_p = syl_utt_p++;
                INTPTR syl_phone_c = 1;

                do_phones(u.phr_vector[i].word_vector[i1].syl_vector[i2]);

                for (INTPTR i3 = 0; i3 < u.phr_vector[i].word_vector[i1].syl_vector[i2].phone_vector.GetSize(); i3++) {
                    u.phone_c++;
                    u.phr_vector[i].phone_c = phrase_pho_c++;
                    u.phr_vector[i].word_vector[i1].phone_c = word_pho_c++;
                    u.phr_vector[i].word_vector[i1].syl_vector[i2].phone_c = syl_phone_c++;
                    phone_struct p = u.phr_vector[i].word_vector[i1].syl_vector[i2].phone_vector[i3];
                    p.utt_p = phone_utt_p++;
                    p.phr_p = phone_phr_p++;
                    p.word_p = phone_word_p++;
                    u.phr_vector[i].word_vector[i1].syl_vector[i2].phone_vector[i3] = p;

                }

            }
            words.RemoveItem(0, 1);
        }
    }




    if (print_label) print_u(u);
    res = do_label(u);
    return res;
}
开发者ID:ikiissel,项目名称:synthts_vr,代码行数:93,代码来源:mklab.cpp

示例11: OnValReadEnd

	void OnValReadEnd(const CFSAString &szKey, CFSVar &Data) {
		if (szKey.IsEmpty()) {
			SubKeys("paragraphs", Data);
			m_Writer.ObjectEnd();
		} else if (szKey=="/paragraphs") {
			m_Writer.ArrayEnd();
			m_iCollectData++;
		} else if (KeyMatch(szKey, "/paragraphs/%d")) {
			SubKeys("sentences", Data);
			m_Writer.ObjectEnd();
			m_iCollectData--;
		} else if (KeyMatch(szKey, "/paragraphs/%d/sentences")) {
			m_Writer.ArrayEnd();
			m_iCollectData++;
		} else if (KeyMatch(szKey, "/paragraphs/%d/sentences/%d")) {
			if (Data.KeyExist("words")) {

				CFSVar &Words=Data["words"];
				CFSArray<CMorphInfos> WordsAnalysis;
				for (INTPTR ip=0; ip<Words.GetSize(); ip++) {
					const CFSVar &Word=Words[ip];
					CMorphInfos Analysis;
					Analysis.m_szWord=Word["text"].GetWString();
					const CFSVar &VarAnalysis=Word["analysis"];
					for (INTPTR ip2=0; ip2<VarAnalysis.GetSize(); ip2++) {
						const CFSVar &VarAnalysis1=VarAnalysis[ip2];
						CMorphInfo Analysis1;
						Analysis1.m_szRoot=VarAnalysis1["root"].GetWString();
						Analysis1.m_szEnding=VarAnalysis1["ending"].GetWString();
						Analysis1.m_szClitic=VarAnalysis1["clitic"].GetWString();
						Analysis1.m_cPOS=VarAnalysis1["partofspeech"].GetWString()[0];
						Analysis1.m_szForm=VarAnalysis1["form"].GetWString();
						Analysis.m_MorphInfo.AddItem(Analysis1);
					}
					WordsAnalysis.AddItem(Analysis);
				}

				WordsAnalysis=m_Disambiguator.Disambiguate(WordsAnalysis);
				RT_ASSERT(Words.GetSize()==WordsAnalysis.GetSize());

				for (INTPTR ip=0; ip<Words.GetSize(); ip++) {
					const CMorphInfos &Analysis=WordsAnalysis[ip];
					CFSVar VarAnalysis;
					VarAnalysis.Cast(CFSVar::VAR_ARRAY);
					for (INTPTR ipRes=0; ipRes<Analysis.m_MorphInfo.GetSize(); ipRes++) {
						const CMorphInfo &Analysis1=Analysis.m_MorphInfo[ipRes];
						CFSVar VarAnalysis1;
						VarAnalysis1["root"]=Analysis1.m_szRoot;
						VarAnalysis1["ending"]=Analysis1.m_szEnding;
						VarAnalysis1["clitic"]=Analysis1.m_szClitic;
						VarAnalysis1["partofspeech"]=CFSWString(Analysis1.m_cPOS);
						VarAnalysis1["form"]=Analysis1.m_szForm;
						VarAnalysis[ipRes]=VarAnalysis1;
					}
					Words[ip]["analysis"]=VarAnalysis;
				}

			}
			m_Writer.Val(Data);
			m_iCollectData--;
		}
	}
开发者ID:theranger,项目名称:vabamorf,代码行数:62,代码来源:etdisamb.cpp


注:本文中的CFSArray::AddItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。