2010-04-08 21:16:10 +04:00
|
|
|
#pragma once
|
2010-10-12 20:17:41 +04:00
|
|
|
// $Id$
|
|
|
|
/***********************************************************************
|
|
|
|
Moses - factored phrase-based, hierarchical and syntactic language decoder
|
|
|
|
Copyright (C) 2009 Hieu Hoang
|
2011-02-24 16:57:11 +03:00
|
|
|
|
2010-10-12 20:17:41 +04:00
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
2011-02-24 16:57:11 +03:00
|
|
|
|
2010-10-12 20:17:41 +04:00
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Lesser General Public License for more details.
|
2011-02-24 16:57:11 +03:00
|
|
|
|
2010-10-12 20:17:41 +04:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
|
|
License along with this library; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
***********************************************************************/
|
2010-04-08 21:16:10 +04:00
|
|
|
#include <string>
|
2012-11-13 00:30:39 +04:00
|
|
|
#include "SourcePhrase.h"
|
|
|
|
#include "TargetPhrase.h"
|
2010-04-08 21:16:10 +04:00
|
|
|
|
|
|
|
typedef std::pair<size_t, size_t> AlignPair;
|
|
|
|
typedef std::vector<AlignPair> AlignType;
|
|
|
|
|
2012-09-20 00:48:10 +04:00
|
|
|
OnDiskPt::WordPtr Tokenize(OnDiskPt::Phrase &phrase
|
2011-02-24 16:57:11 +03:00
|
|
|
, const std::string &token, bool addSourceNonTerm, bool addTargetNonTerm
|
|
|
|
, OnDiskPt::OnDiskWrapper &onDiskWrapper);
|
2012-09-20 00:48:10 +04:00
|
|
|
OnDiskPt::PhrasePtr Tokenize(OnDiskPt::SourcePhrase &sourcePhrase, OnDiskPt::TargetPhrase &targetPhrase
|
2011-02-24 16:57:11 +03:00
|
|
|
, char *line, OnDiskPt::OnDiskWrapper &onDiskWrapper
|
|
|
|
, int numScores
|
|
|
|
, std::vector<float> &misc);
|
2010-04-08 21:16:10 +04:00
|
|
|
|
|
|
|
void InsertTargetNonTerminals(std::vector<std::string> &sourceToks, const std::vector<std::string> &targetToks, const AlignType &alignments);
|
|
|
|
void SortAlign(AlignType &alignments);
|
|
|
|
bool Flush(const OnDiskPt::SourcePhrase *prevSource, const OnDiskPt::SourcePhrase *currSource);
|
|
|
|
|