mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-10-27 11:59:52 +03:00
5240c430ce
This adds a new string-to-tree decoder, which can be enabled with the -s2t option. It's intended to be faster and simpler than the generic chart decoder, and is designed to support lattice input (still WIP). For a en-de system trained on WMT14 data, it's approximately 40% faster in practice. For background information, see the decoding section of the EMNLP tutorial on syntax-based MT: http://www.emnlp2014.org/tutorials/5_notes.pdf Some features are not implemented yet, including support for internal tree structure and soft source-syntactic constraints.
38 lines
597 B
C++
38 lines
597 B
C++
#include "CubeQueue.h"
|
|
|
|
namespace Moses
|
|
{
|
|
namespace Syntax
|
|
{
|
|
|
|
CubeQueue::~CubeQueue()
|
|
{
|
|
while (!m_queue.empty()) {
|
|
Cube *cube = m_queue.top();
|
|
m_queue.pop();
|
|
delete cube;
|
|
}
|
|
}
|
|
|
|
SHyperedge *CubeQueue::Pop()
|
|
{
|
|
// pop the most promising cube
|
|
Cube *cube = m_queue.top();
|
|
m_queue.pop();
|
|
|
|
// pop the most promising hyperedge from the cube
|
|
SHyperedge *hyperedge = cube->Pop();
|
|
|
|
// if the cube contains more items then push it back onto the queue
|
|
if (!cube->IsEmpty()) {
|
|
m_queue.push(cube);
|
|
} else {
|
|
delete cube;
|
|
}
|
|
|
|
return hyperedge;
|
|
}
|
|
|
|
} // Syntax
|
|
} // Moses
|