Skip to content

Commit

Permalink
daily automatic beautifier
Browse files Browse the repository at this point in the history
  • Loading branch information
mosesadmin committed Feb 1, 2017
1 parent 11e422d commit 657deae
Show file tree
Hide file tree
Showing 9 changed files with 1,188 additions and 1,205 deletions.
2 changes: 1 addition & 1 deletion moses/Util.h
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ inline float CalcTranslationScore(const std::vector<float> &probVector,
out << *this; \
return out.str(); \
} \

//! delete and remove every element of a collection object such as set, list etc
template<class COLL>
void RemoveAllInColl(COLL &coll)
Expand Down
6 changes: 2 additions & 4 deletions moses2/TranslationModel/ProbingPT/line_splitter.hh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ namespace Moses2
{

//Struct for holding processed line
struct line_text
{
struct line_text {
StringPiece source_phrase;
StringPiece target_phrase;
StringPiece prob;
Expand All @@ -26,8 +25,7 @@ struct line_text
};

//Struct for holding processed line
struct target_text
{
struct target_text {
std::vector<unsigned int> target_phrase;
std::vector<float> prob;
std::vector<size_t> word_align_term;
Expand Down
12 changes: 4 additions & 8 deletions moses2/TranslationModel/ProbingPT/probing_hash_utils.hh
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,15 @@ namespace Moses2
#define API_VERSION 15

//Hash table entry
struct Entry
{
struct Entry {
typedef uint64_t Key;
Key key;

Key GetKey() const
{
Key GetKey() const {
return key;
}

void SetKey(Key to)
{
void SetKey(Key to) {
key = to;
}

Expand All @@ -42,8 +39,7 @@ char * readTable(const char * filename, util::LoadMethod load_method, util::scop

uint64_t getKey(const uint64_t source_phrase[], size_t size);

struct TargetPhraseInfo
{
struct TargetPhraseInfo {
uint32_t alignTerm;
uint32_t alignNonTerm;
uint16_t numWords;
Expand Down
13 changes: 7 additions & 6 deletions moses2/TranslationModel/ProbingPT/querying.hh
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,18 @@ public:

std::pair<bool, uint64_t> query(uint64_t key);

const std::map<uint64_t, std::string> &getSourceVocab() const
{ return source_vocabids; }
const std::map<uint64_t, std::string> &getSourceVocab() const {
return source_vocabids;
}

const std::vector<Alignments> &getAlignments() const
{ return alignColl; }
const std::vector<Alignments> &getAlignments() const {
return alignColl;
}

uint64_t getKey(uint64_t source_phrase[], size_t size) const;

template<typename T>
inline bool Get(const boost::unordered_map<std::string, std::string> &keyValue, const std::string &sought, T &found) const
{
inline bool Get(const boost::unordered_map<std::string, std::string> &keyValue, const std::string &sought, T &found) const {
boost::unordered_map<std::string, std::string>::const_iterator iter = keyValue.find(sought);
if (iter == keyValue.end()) {
return false;
Expand Down
23 changes: 10 additions & 13 deletions moses2/TranslationModel/ProbingPT/storing.hh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public:
bool done;

Node()
:done(false)
:done(false)
{}

void Add(Table &table, const SourcePhrase &sourcePhrase, size_t pos = 0);
Expand All @@ -41,8 +41,8 @@ public:


void createProbingPT(const std::string &phrasetable_path,
const std::string &basepath, int num_scores, int num_lex_scores,
bool log_prob, int max_cache_size, bool scfg);
const std::string &basepath, int num_scores, int num_lex_scores,
bool log_prob, int max_cache_size, bool scfg);
uint64_t getKey(const std::vector<uint64_t> &source_phrase);

std::vector<uint64_t> CreatePrefix(const std::vector<uint64_t> &vocabid_source, size_t endPos);
Expand All @@ -66,30 +66,27 @@ public:
uint64_t sourceKey;
float count;
CacheItem(const std::string &vSource, uint64_t vSourceKey, float vCount)
:source(vSource)
,sourceKey(vSourceKey)
,count(vCount)
{
:source(vSource)
,sourceKey(vSourceKey)
,count(vCount) {
}

bool operator<(const CacheItem &other) const
{
bool operator<(const CacheItem &other) const {
return count > other.count;
}
};

class CacheItemOrderer
{
public:
bool operator()(const CacheItem* a, const CacheItem* b) const
{
bool operator()(const CacheItem* a, const CacheItem* b) const {
return (*a) < (*b);
}
};

void serialize_cache(
std::priority_queue<CacheItem*, std::vector<CacheItem*>, CacheItemOrderer> &cache,
const std::string &path, float totalSourceCount);
std::priority_queue<CacheItem*, std::vector<CacheItem*>, CacheItemOrderer> &cache,
const std::string &path, float totalSourceCount);

}

4 changes: 2 additions & 2 deletions moses2/TranslationModel/ProbingPT/vocabid.hh
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ template<typename VOCABID>
class StoreVocab;

void add_to_map(StoreVocab<uint64_t> &sourceVocab,
const StringPiece &textin);
const StringPiece &textin);

void serialize_map(const std::map<uint64_t, std::string> &karta,
const std::string &filename);
const std::string &filename);

void read_map(std::map<uint64_t, std::string> &karta, const char* filename);

Expand Down
2 changes: 1 addition & 1 deletion moses2/pugiconfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
Expand Down
2 changes: 1 addition & 1 deletion moses2/pugixml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
#endif

#ifdef __INTEL_COMPILER
# pragma warning(disable: 177) // function was declared but never referenced
# pragma warning(disable: 177) // function was declared but never referenced
# pragma warning(disable: 279) // controlling expression is constant
# pragma warning(disable: 1478 1786) // function was declared "deprecated"
# pragma warning(disable: 1684) // conversion from pointer to same-sized integral type
Expand Down
Loading

0 comments on commit 657deae

Please sign in to comment.