Download mosesdecoder/moses/PP/CountsPhraseProperty.cpp from sleepyhead111/vllm_fairseq: direct link, hf CLI and curl.
- Browser
- Download file 1.05 kB
-
https://huggingface.co/sleepyhead111/vllm_fairseq/resolve/main/mosesdecoder/moses/PP/CountsPhraseProperty.cpp
- Command line
-
hf download hf://sleepyhead111/vllm_fairseq/mosesdecoder/moses/PP/CountsPhraseProperty.cpp
-
curl -L -o CountsPhraseProperty.cpp https://huggingface.co/sleepyhead111/vllm_fairseq/resolve/main/mosesdecoder/moses/PP/CountsPhraseProperty.cpp
1.05 kB
| namespace Moses | |
| { | |
| void CountsPhraseProperty::ProcessValue(const std::string &value) | |
| { | |
| std::istringstream tokenizer(value); | |
| if (! (tokenizer >> m_targetMarginal)) { // first token: countE | |
| UTIL_THROW2("CountsPhraseProperty: Not able to read target marginal. Flawed property?"); | |
| } | |
| assert( m_targetMarginal > 0 ); | |
| if (! (tokenizer >> m_sourceMarginal)) { // first token: countF | |
| UTIL_THROW2("CountsPhraseProperty: Not able to read source marginal. Flawed property?"); | |
| } | |
| assert( m_sourceMarginal > 0 ); | |
| if (! (tokenizer >> m_jointCount)) { // first token: countEF | |
| UTIL_THROW2("CountsPhraseProperty: Not able to read joint count. Flawed property?"); | |
| } | |
| assert( m_jointCount > 0 ); | |
| }; | |
| std::ostream& operator<<(std::ostream &out, const CountsPhraseProperty &obj) | |
| { | |
| out << "Count property=" | |
| << obj.GetTargetMarginal() << " " | |
| << obj.GetSourceMarginal() << " " | |
| << obj.GetJointCount(); | |
| return out; | |
| } | |
| } // namespace Moses | |