本文整理汇总了C++中CFSArray::GetSize方法的典型用法代码示例。如果您正苦于以下问题:C++ CFSArray::GetSize方法的具体用法?C++ CFSArray::GetSize怎么用?C++ CFSArray::GetSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFSArray
的用法示例。
在下文中一共展示了CFSArray::GetSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: FSJNIStrtoW
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;
}
}
示例3: 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;
}
}
示例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;
}
示例5: 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;
}
示例6: MorphInfoToJNI
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;
}
}
示例7: 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;
}
示例8: 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;
}
示例9: 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;
}
示例10: JNIToMorphInfo
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;
}
}
示例11: 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;
}
示例12: 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;
}
}
示例13: 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;
}
}
示例14: add_stress2
void add_stress2(CFSArray<syl_struct> &sv, INTPTR wp) {
/* Kõige radikaalsem rõhutus siiani.
* wp = kui on liitsõna esimene liige siis on seal pearõhk.
*/
INTPTR main_stress = 2;
INTPTR stress = 1;
INTPTR size = sv.GetSize();
INTPTR stress_type = extra_stress(sv, size);
if (stress_type == 0) {
for (INTPTR i = 0; i < size; i++) {
if (i % 2 == 0) {
if ((i == 0) && (wp == 0))
sv[i].stress = main_stress;
else
sv[i].stress = stress;
}
}
if (size > 1) sv[size - 1].stress = 0;
}
else {
if (wp == 0)
sv[stress_type].stress = main_stress;
else
sv[stress_type].stress = stress;
//esimene pool
if (stress_type == 1) sv[0].stress = 0;
else
for (INTPTR i = stress_type - 1; i >= 0; i--)
if (i % 2 == 0)
sv[i].stress = stress;
if ((stress_type % 2 != 0) && (stress_type > 1))
sv[stress_type - 1].stress = 0;
//teine pool
INTPTR lopp = size - stress_type;
if (lopp > 3) {
for (INTPTR i = stress_type + 1; i < size; i++)
if (i % 2 != 0) sv[i].stress = stress;
sv[size - 1].stress = 0;
}
}
}
示例15: addSuggestions
// spellcheck the words and add suggestions
void addSuggestions(CLinguistic& linguistic, CFSArray<CFSVar>& words, const bool suggest) {
for (INTPTR ip=0; ip<words.GetSize(); ip++) {
CFSVar &Word=words[ip];
CPTWord PTWord=Word["text"].GetWString();
PTWord.RemoveHyphens();
PTWord.RemovePunctuation();
PTWord.Trim();
if (PTWord.m_szWord.IsEmpty() || linguistic.SpellWord(PTWord.m_szWord)==SPL_NOERROR) {
Word["spelling"]=true;
} else {
Word["spelling"]=false;
if (suggest) {
CFSWStringArray Suggestions=linguistic.Suggest(PTWord.m_szWord);
CFSVar VarSuggestions;
VarSuggestions.Cast(CFSVar::VAR_ARRAY);
for (INTPTR ipRes=0; ipRes<Suggestions.GetSize(); ipRes++) {
VarSuggestions[ipRes]=Suggestions[ipRes];
}
Word["suggestions"]=VarSuggestions;
}
}
}
}