本文整理汇总了C++中Language::size方法的典型用法代码示例。如果您正苦于以下问题:C++ Language::size方法的具体用法?C++ Language::size怎么用?C++ Language::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Language
的用法示例。
在下文中一共展示了Language::size方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: append
void Language::append(const Language &language) {
for(unsigned int i = 0; i < language.size(); i++){
Word* word = language.getWord(i);
this->addWord(new Word(word));
}
}
示例2: Word
Language::Language(const Language &language) :
_alphabet(language.getAlphabet()){
for(unsigned int i = 0; i < language.size(); i++){
Word* otherWord = language.getWord(i);
Word *word = new Word(*otherWord);
this->addWord(word);
}
}
示例3: similarity
double similarity(const Language &language1, const Language &language2) {
unsigned int size1 = language1.size();
unsigned int size2 = language2.size();
std::vector<double> wordSimilarities;
double similarityLanguage = 0;
for(unsigned int i = 0; i < size1; i++){
wordSimilarities.clear();
Word* word1 = language1.getWord(i);
for(unsigned int j = 0; j < size2; j++){
Word* word2 = language2.getWord(j);
double similarity = word::similarity(*word1, *word2);
wordSimilarities.push_back(similarity);
}
double maxSimilarity = math::max(wordSimilarities);
similarityLanguage += maxSimilarity;
}
similarityLanguage /= size1;
return similarityLanguage;
}