Send Moses-support mailing list submissions to
moses-support@mit.edu
To subscribe or unsubscribe via the World Wide Web, visit
http://mailman.mit.edu/mailman/listinfo/moses-support
or, via email, send a message with subject or body 'help' to
moses-support-request@mit.edu
You can reach the person managing the list at
moses-support-owner@mit.edu
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Moses-support digest..."
Today's Topics:
1. Re: Getting source phrase from confusion network (Hieu Hoang)
----------------------------------------------------------------------
Message: 1
Date: Thu, 06 Nov 2014 17:05:49 +0000
From: Hieu Hoang <hieuhoang@gmail.com>
Subject: Re: [Moses-support] Getting source phrase from confusion
network
To: Marcin Junczys-Dowmunt <junczys@amu.edu.pl>, moses-support
<moses-support@mit.edu>
Message-ID: <545BAA6D.4010700@gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
GetWord(int) returns a word and is only valid for a sentence/phrase.
Try
hypo.GetTranslationOption().GetInputPath().GetPhrase()
This is the actual input subphrase that used to do the lookup of the
translation rule
On 06/11/14 15:19, Marcin Junczys-Dowmunt wrote:
>
> Hi Hieu,
>
> I have an OSM-like feature whigh I want to use with Confusion
> Networks. How would I get the actual source words used in the current
> hypothesis?
>
> The code below works for sentences, but fails with an exception for
> confusion networks, as GetWord (last line) is not allowed.
>
> Thanks for any pointers,
>
> Cheers,
>
> Marcin
>
> FFState* EditSequenceModel::EvaluateWhenApplied(
> const Hypothesis& cur_hypo,
> const FFState* prev_state,
> ScoreComponentCollection* accumulator) const
> {
> std::vector<StringPiece> mySourcePhrase;
> std::vector<StringPiece> myTargetPhrase;
> std::vector<size_t> alignments;
>
> const Manager &manager = cur_hypo.GetManager();
> const InputType &source = manager.GetSource();
> const WordsRange& sourceRange = cur_hypo.GetCurrSourceWordsRange();
> size_t startIndex = sourceRange.GetStartPos();
> size_t endIndex = sourceRange.GetEndPos();
> for (size_t i = startIndex; i <= endIndex; i++)
> mySourcePhrase.push_back(source.GetWord(i).GetFactor(m_sFactor)->GetString());
>
> .
> .
> .
> .
------------------------------
_______________________________________________
Moses-support mailing list
Moses-support@mit.edu
http://mailman.mit.edu/mailman/listinfo/moses-support
End of Moses-support Digest, Vol 97, Issue 7
********************************************
Subscribe to:
Post Comments (Atom)
0 Response to "Moses-support Digest, Vol 97, Issue 7"
Post a Comment