Skip to content

Commit

Permalink
Fixed Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
joka921 committed Oct 7, 2018
1 parent 0411653 commit 6968447
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 13 deletions.
1 change: 0 additions & 1 deletion src/index/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@ add_library(metaConverter
MetaDataConverter.cpp MetaDataConverter.h)

target_link_libraries(metaConverter index)

20 changes: 11 additions & 9 deletions src/index/Index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ Index::Index()

// _____________________________________________________________________________________________
template <class Parser>
std::unique_ptr<Index::ExtVec> Index::createExtVecAndVocab(const string& filename) {
std::unique_ptr<Index::ExtVec> Index::createExtVecAndVocab(
const string& filename) {
initializeVocabularySettingsBuild();

auto linesAndWords =
Expand Down Expand Up @@ -152,7 +153,8 @@ LinesAndWords Index::passFileForVocabulary(const string& filename,
std::unique_ptr<ExtVec> idTriples(new ExtVec());
ExtVec::bufwriter_type writer(*idTriples);
while (!stopParsing) {
auto futBatch = std::async(std::launch::async, parseBatch<Parser>, &p, linesPerPartial);
auto futBatch =
std::async(std::launch::async, parseBatch<Parser>, &p, linesPerPartial);
google::sparse_hash_map<string, Id> items;
// We will insert many duplicates into this hashSet, should be faster to
// keep this separate
Expand All @@ -170,20 +172,20 @@ LinesAndWords Index::passFileForVocabulary(const string& filename,
actualCurrentPartialSize++;

if (!langtag.empty()) {
auto langTagId = assignNextId(
auto langTagId = assignNextId(
&items, ad_utility::convertLangtagToEntityUri(langtag));
auto langTaggedPredId = assignNextId(
&items,
ad_utility::convertToLanguageTaggedPredicate(spo[1], langtag));
writer << array<Id, 3>{{spoIds[0], langTaggedPredId, spoIds[2]}};
writer << array<Id, 3>{{spoIds[2], langPredId, langTagId}};
actualCurrentPartialSize += 2;
}
}

++i;
if (i % 10000000 == 0) {
LOG(INFO) << "Lines processed: " << i << '\n';
}
++i;
if (i % 10000000 == 0) {
LOG(INFO) << "Lines processed: " << i << '\n';
}
}
// we don't need this memory anymore
std::vector<std::array<std::string, 3>>().swap(tripleBuf);
Expand Down Expand Up @@ -1808,7 +1810,7 @@ std::pair<bool, std::vector<array<string, 3>>> Index::parseBatch(

// ___________________________________________________________________________
template <class Map>
Id Index::assignNextId(Map * mapPtr, const string& key) {
Id Index::assignNextId(Map* mapPtr, const string& key) {
Map& map = *mapPtr;
if (map.find(key) == map.end()) {
Id res = map.size();
Expand Down
2 changes: 1 addition & 1 deletion src/index/Index.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

#include <array>
#include <fstream>
#include <memory>
#include <google/sparse_hash_set>
#include <memory>
#include <nlohmann/json.hpp>
#include <optional>
#include <string>
Expand Down
1 change: 0 additions & 1 deletion src/index/VocabularyGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,3 @@ google::sparse_hash_map<Id, Id> IdMapFromPartialIdMapFile(
}
return res;
}

1 change: 0 additions & 1 deletion src/index/VocabularyGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,3 @@ void writePartialIdMapToBinaryFileForMerging(
// _________________________________________________________________________________________
google::sparse_hash_map<Id, Id> IdMapFromPartialIdMapFile(
const string& mmapFilename);

0 comments on commit 6968447

Please sign in to comment.