00001 /*********************************************************************** 00002 Moses - statistical machine translation system 00003 Copyright (C) 2006-2011 University of Edinburgh 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public 00007 License as published by the Free Software Foundation; either 00008 version 2.1 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Lesser General Public License for more details. 00014 00015 You should have received a copy of the GNU Lesser General Public 00016 License along with this library; if not, write to the Free Software 00017 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00018 ***********************************************************************/ 00019 00020 #pragma once 00021 00022 #include "HypoList.h" 00023 #include "Word.h" 00024 #include "WordsRange.h" 00025 00026 namespace search { class Vertex; } 00027 00028 namespace Moses 00029 { 00030 00031 class Word; 00032 00038 class ChartCellLabel 00039 { 00040 public: 00041 union Stack { 00042 const HypoList *cube; // cube pruning 00043 search::Vertex *incr; // incremental search after filling. 00044 void *incr_generator; // incremental search during filling. 00045 }; 00046 00047 00048 ChartCellLabel(const WordsRange &coverage, const Word &label, 00049 Stack stack=Stack()) 00050 : m_coverage(coverage) 00051 , m_label(label) 00052 , m_stack(stack) 00053 {} 00054 00055 const WordsRange &GetCoverage() const { return m_coverage; } 00056 const Word &GetLabel() const { return m_label; } 00057 Stack GetStack() const { return m_stack; } 00058 Stack &MutableStack() { return m_stack; } 00059 00060 bool operator<(const ChartCellLabel &other) const 00061 { 00062 // m_coverage and m_label uniquely identify a ChartCellLabel, so don't 00063 // need to compare m_stack. 00064 if (m_coverage == other.m_coverage) { 00065 return m_label < other.m_label; 00066 } 00067 return m_coverage < other.m_coverage; 00068 } 00069 00070 private: 00071 const WordsRange &m_coverage; 00072 const Word &m_label; 00073 Stack m_stack; 00074 }; 00075 00076 }
1.5.9