facebookresearch / StarSpace

Learning embeddings for classification, retrieval and ranking.
MIT License
3.95k stars 531 forks source link

Syntax Error #277

Closed raffaem closed 2 years ago

raffaem commented 5 years ago

When compiling latest commit ce38eecfdbd41dd7d400b806dbf9cef20442fa01 on Visual Studio 2019

1>D:\SourcePrograms\StarSpace\src\model.cpp(235,38): error C2146:  syntax error: missing ')' before identifier 'or'
1>D:\SourcePrograms\StarSpace\src\model.cpp(235,38): error C2065:  'or': undeclared identifier
1>D:\SourcePrograms\StarSpace\src\model.cpp(235,41): error C2146:  syntax error: missing ';' before identifier 'ex'
1>D:\SourcePrograms\StarSpace\src\model.cpp(235,1): error C2059:  syntax error: ')'
1>D:\SourcePrograms\StarSpace\src\model.cpp(236,11): error C2059:  syntax error: 'continue'
1>D:\SourcePrograms\StarSpace\src\model.cpp(238,28): error C2065:  'ex': undeclared identifier
1>D:\SourcePrograms\StarSpace\src\model.cpp(241,54): warning C4244:  'argument': conversion from 'const starspace::Real' to 'int32_t', possible loss of data
1>D:\SourcePrograms\StarSpace\src\model.cpp(243,54): warning C4244:  'argument': conversion from 'const starspace::Real' to 'size_t', possible loss of data
1>D:\SourcePrograms\StarSpace\src\model.cpp(254,12): error C2065:  'i': undeclared identifier
1>D:\SourcePrograms\StarSpace\src\model.cpp(262,25): error C2065:  'ip': undeclared identifier
1>D:\SourcePrograms\StarSpace\src\model.cpp(262,63): error C2065:  'ip': undeclared identifier
1>D:\SourcePrograms\StarSpace\src\model.cpp(266,37): error C2065:  'ip': undeclared identifier
NicksonYap commented 4 years ago

In src/model.cpp,

the correct:

 if (s.RHSTokens.size() == 0 || s.LHSTokens.size() == 0) {

at https://github.com/facebookresearch/StarSpace/commit/8790244ebb37ebc39ac72562ea7678591289286a#diff-236dfd41d36580e127f9bdb8158d5419L169

was replaced with the wrong:

if (ex.LHSTokens.size() == 0 or ex.RHSTokens.size() == 0) {

https://github.com/facebookresearch/StarSpace/commit/8790244ebb37ebc39ac72562ea7678591289286a#diff-236dfd41d36580e127f9bdb8158d5419R237

Fix it by changing the or into || in https://github.com/facebookresearch/StarSpace/blob/8aee0a950aa607c023e5c91cff518bec335b5df5/src/model.cpp#L235