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


C++ CFSArray类代码示例

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


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

示例1: Java_ee_filosoft_vabamorf_Linguistic_synthesize

JNIEXPORT jobjectArray JNICALL Java_ee_filosoft_vabamorf_Linguistic_synthesize(JNIEnv *env, jobject jobj, jobject info, jstring hint)
{
	FUNCTION_HEADER;
	if (!linguistic) return NULL;

	try {
		jclass MorphInfoClass = env->FindClass("ee/filosoft/vabamorf/Linguistic$MorphInfo");
		jmethodID MorphInfoClassConstructor = (MorphInfoClass ? env->GetMethodID(MorphInfoClass, "<init>", "()V") : 0);
		if (!MorphInfoClassConstructor) return NULL;

		CMorphInfo morphInfo;
		morphInfo.m_szRoot = FSJNIStrtoW(env, FSJNIGetStringField(env, info, "root"));
		morphInfo.m_szClitic = FSJNIStrtoW(env, FSJNIGetStringField(env, info, "clitic"));
		morphInfo.m_cPOS = FSJNIGetCharField(env, info, "pos");
		morphInfo.m_szForm = FSJNIStrtoW(env, FSJNIGetStringField(env, info, "form"));

		CFSArray<CMorphInfo> results = linguistic->Synthesize(morphInfo, FSJNIStrtoW(env, hint));

		jobjectArray synths=(jobjectArray)env->NewObjectArray(results.GetSize(), env->FindClass("java/lang/Object"), 0);
		for (INTPTR ip=0; ip<results.GetSize(); ip++) {
			jobject analyze1=env->NewObject(MorphInfoClass, MorphInfoClassConstructor);
			FSJNISetStringField(env, analyze1, "root", FSJNIWtoStr(env, results[ip].m_szRoot));
			FSJNISetStringField(env, analyze1, "ending", FSJNIWtoStr(env, results[ip].m_szEnding));
			FSJNISetStringField(env, analyze1, "clitic", FSJNIWtoStr(env, results[ip].m_szClitic));
			FSJNISetCharField(env, analyze1, "pos", results[ip].m_cPOS);
			FSJNISetStringField(env, analyze1, "form", FSJNIWtoStr(env, results[ip].m_szForm));
			env->SetObjectArrayElement(synths, ip, analyze1);
		}
		return synths;
	} catch(...) {
		return NULL;
	}
}
开发者ID:keeleleek,项目名称:vabamorf,代码行数:33,代码来源:linguistic_jni.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: 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

示例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";
        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

示例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: 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

示例7: convertSpellingOutput

// convert output to wrapper format
std::vector<SpellingResults> convertSpellingOutput(CFSArray<CFSVar>& words) {
    std::vector<SpellingResults> results;
    results.reserve(words.GetSize());
    for (int widx=0 ; widx < words.GetSize() ; ++widx) {
        CFSVar word = words[widx];
        std::string text = std::string(word["text"].GetAString());
        CFSVar suggestions = word["suggestions"];
        StringVector suggestStrings;
        suggestStrings.reserve(suggestions.GetSize());
        for (int sidx=0 ; sidx < suggestions.GetSize() ; ++sidx) {
            CFSVar suggestion = suggestions[sidx];
            suggestStrings.push_back(std::string(suggestion.GetAString()));
        }
        results.push_back(SpellingResults(text, word["spelling"].GetInt(), suggestStrings));
    }
    return results;
}
开发者ID:urdvr,项目名称:estnltk,代码行数:18,代码来源:vabamorf.cpp

示例8: Java_ee_filosoft_vabamorf_Linguistic_analyze

JNIEXPORT jobjectArray JNICALL Java_ee_filosoft_vabamorf_Linguistic_analyze(JNIEnv *env, jobject jobj, jstring word)
{
	FUNCTION_HEADER;
	if (!linguistic) return NULL;

	try {
		CFSArray<CMorphInfo> results = linguistic->Analyze(FSJNIStrtoW(env, word));

		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, MorphInfoToJNI(env, results[ip]));
		}
		return analyzes;
	} catch(...) {
		return NULL;
	}
}
开发者ID:Filosoft,项目名称:vabamorf,代码行数:17,代码来源:linguistic_jni.cpp

示例9: convertOutput

// convert vabamorf base library output to WordAnalysis instances, which as easier to wrap.
std::vector<WordAnalysis> convertOutput(CFSArray<CFSVar>& words) {
    std::vector<WordAnalysis> results;
    results.reserve(words.GetSize());
    for (int widx=0 ; widx < words.GetSize() ; ++widx) {
        CFSVar word = words[widx];
        CFSVar analysis = word["analysis"];
        AnalysisVector vec;
        for (int aidx=0 ; aidx < analysis.GetSize() ; ++aidx) {
            CFSVar a = analysis[aidx];
            vec.push_back(Analysis(a["root"].GetAString(),
                                   a["ending"].GetAString(),
                                   a["clitic"].GetAString(),
                                   a["partofspeech"].GetAString(),
                                   a["form"].GetAString()));
        }
        results.push_back(WordAnalysis(std::string(word["text"].GetAString()), vec));
    }
    return results;
}
开发者ID:urdvr,项目名称:estnltk,代码行数:20,代码来源:vabamorf.cpp

示例10: convertDisambOutput

std::vector<WordAnalysis> convertDisambOutput(CFSArray<CMorphInfos> const& morphInfos) {
    std::vector<WordAnalysis> output;
    const int n = morphInfos.GetSize();
    output.reserve(n);
    for (int i=0 ; i<n ; ++i) {
        CMorphInfos const& infos = morphInfos[i];
        output.push_back(convertMorphInfos(infos));
    }
    return output;
}
开发者ID:urdvr,项目名称:estnltk,代码行数:10,代码来源:vabamorf.cpp

示例11: tokens2words

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

示例12: Java_ee_filosoft_vabamorf_Linguistic_synthesize

JNIEXPORT jobjectArray JNICALL Java_ee_filosoft_vabamorf_Linguistic_synthesize(JNIEnv *env, jobject jobj, jobject info, jstring hint)
{
	FUNCTION_HEADER;
	if (!linguistic) return NULL;

	try {
		CMorphInfo MorphInfo = JNIToMorphInfo(env, info);
		MorphInfo.m_szEnding.Empty();

		CFSArray<CMorphInfo> results = linguistic->Synthesize(MorphInfo, FSJNIStrtoW(env, hint));

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

示例13: DisambiguateSynthesisResult

CMorphInfo DisambiguateSynthesisResult(CFSArray<CMorphInfo> MIs, CPTWord s) {
    CFSWString s1;
    CMorphInfo x;

    for (INTPTR i = 0; i < MIs.GetSize(); i++) {
        s1 = MIs[i].m_szRoot + MIs[i].m_szEnding + MIs[i].m_szClitic;
        if (s.m_szWord == make_char_string(s1)) {
            MIs[i].m_szRoot = s1;
            return MIs[i];
        }
    }
    x.m_szRoot = s.m_szWord;
    return x;
}
开发者ID:ikiissel,项目名称:synthts_et,代码行数:14,代码来源:mklab.cpp

示例14: Java_ee_filosoft_vabamorf_Linguistic_analyzeSentence

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

示例15: Java_ee_filosoft_vabamorf_Linguistic_spellWords

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


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