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: string of Words + states in feature functions
(HOANG Cong Duy Vu)
2. Re: string of Words + states in feature functions (Hieu Hoang)
3. Re: string of Words + states in feature functions (Matthias Huck)
4. When does this error message occur and how to fix it (Raj Dabre)
----------------------------------------------------------------------
Message: 1
Date: Wed, 10 Dec 2014 17:32:46 +0800
From: HOANG Cong Duy Vu <duyvuleo@gmail.com>
Subject: Re: [Moses-support] string of Words + states in feature
functions
To: amir haghighi <amir.haghighi.64@gmail.com>
Cc: moses-support <moses-support@mit.edu>
Message-ID:
<CAPRaJX39UDXWsUW8rTOKiXEQzDDh=xDk3P0nYWcv23HfFr00rQ@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
More:
word_str = source_sent.GetWord(pos).GetString(m_factorType)
--
Cheers,
Vu
On Wed, Dec 10, 2014 at 5:26 PM, HOANG Cong Duy Vu <duyvuleo@gmail.com>
wrote:
> Hi Amir,
>
> I'm implementing a feature function in moses-chart. I need the source
>> words string and also their indexes in the source sentence. I've written a
>> function that gets the source words but I don't know how extract word
>> string from a word.
>> could anyone guide me how to do that? as I know, each word is implemented
>> as an array of factors, which of them is its string?
>
>
> You can utilize some of the following functions to get the source
> information:
>
> //target phrase and range
> const TargetPhrase& currTargetPhrase = cur_hypo.GetCurrTargetPhrase();
> const WordsRange& sourceWordRage = cur_hypo.GetCurrSourceWordsRange();
>
> //source sentence
> Manager& manager = cur_hypo.GetManager();
> const Sentence& source_sent = static_cast<const
> Sentence&>(manager.GetSource());
>
> //alignment
> const AlignmentInfo& alignments = targetPhrase.GetAlignTerm();
>
> I have also some questions about the states in the stateful features,
>> what kind of variables should be stored in each state? only those ones
>> that should be used in the compare function? or any variable from the
>> previous hypothesis that we use in our feature?
>
>
> Normally, for stateful functions, for instance, previous target words will
> be stored.
>
>
> --
> Cheers,
> Vu
>
> On Wed, Dec 10, 2014 at 4:11 PM, amir haghighi <amir.haghighi.64@gmail.com
> > wrote:
>
>> Hi everyone
>>
>> I'm implementing a feature function in moses-chart. I need the source
>> words string and also their indexes in the source sentence. I've written a
>> function that gets the source words but I don't know how extract word
>> string from a word.
>> could anyone guide me how to do that? as I know, each word is implemented
>> as an array of factors, which of them is its string?
>>
>> I have also some questions about the states in the stateful features,
>> what kind of variables should be stored in each state? only those ones
>> that should be used in the compare function? or any variable from the
>> previous hypothesis that we use in our feature?
>>
>> Thanks in advance!
>>
>> Cheers
>> Amir
>>
>> _______________________________________________
>> Moses-support mailing list
>> Moses-support@mit.edu
>> http://mailman.mit.edu/mailman/listinfo/moses-support
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/mailman/private/moses-support/attachments/20141210/69226a21/attachment-0001.htm
------------------------------
Message: 2
Date: Wed, 10 Dec 2014 09:59:37 +0000
From: Hieu Hoang <hieuhoang@gmail.com>
Subject: Re: [Moses-support] string of Words + states in feature
functions
To: amir haghighi <amir.haghighi.64@gmail.com>, moses-support
<moses-support@mit.edu>
Message-ID: <54881989.9030605@gmail.com>
Content-Type: text/plain; charset="windows-1252"
On 10/12/14 08:11, amir haghighi wrote:
> Hi everyone
>
> I'm implementing a feature function in moses-chart. I need the source
> words string and also their indexes in the source sentence. I've
> written a function that gets the source words but I don't know how
> extract word string from a word.
> could anyone guide me how to do that? as I know, each word is
> implemented as an array of factors, which of them is its string?
>
> I have also some questions about the states in the stateful features,
> what kind of variables should be stored in each state? only those ones
> that should be used in the compare function? or any variable from the
> previous hypothesis that we use in our feature?
You can store anything in the state information that will help you to
calculate function
FFState::Compare(other)
This is the only function you need to implement. The example
SkeletonStatefulFF
class compares the length of the target side of the translation rule
from 2 hypotheses, therefore, it the state only need to store the length
of the target string, not the entire string.
It 2 states are the same Compare() should return 0. If 2 states are
different, then it should return -1 or +1. you MUST make sure if, ie.
if a > b and b > c
then a > c
and
if a > b
then b < a
>
> Thanks in advance!
>
> Cheers
> Amir
>
>
> _______________________________________________
> Moses-support mailing list
> Moses-support@mit.edu
> http://mailman.mit.edu/mailman/listinfo/moses-support
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/mailman/private/moses-support/attachments/20141210/7b1a78cd/attachment-0001.htm
------------------------------
Message: 3
Date: Wed, 10 Dec 2014 10:32:43 +0000
From: Matthias Huck <mhuck@inf.ed.ac.uk>
Subject: Re: [Moses-support] string of Words + states in feature
functions
To: amir haghighi <amir.haghighi.64@gmail.com>
Cc: moses-support <moses-support@mit.edu>
Message-ID: <1418207563.2175.204.camel@portedgar>
Content-Type: text/plain; charset="UTF-8"
Hi Amir,
The input is passed to the feature functions via
InitializeForInput(InputType const& source).
This method is called before search and collecting of translation
options (cf. moses/FF/FeatureFunction.h). You can set a member variable
to have access to the input in your scoring method.
Alternatively, if you implement EvaluateWithSourceContext(), the input
is passed directly to the method as a parameter (const InputType &input)
and you can use that.
Finally, there's another option in the EvaluateWhenApplied() methods.
You can get the input from the Hypothesis object:
const InputType& input = hypo.GetManager().GetSource();
The input is an InputType object. Moses knows different input types, see
InputTypeEnum in moses/TypeDef.h . So what you get might differ
depending on what was passed to the decoder. If you're happy with
implementing your feature for sentence input only, then you can cast the
input to a Sentence object. The Sentence object gives you convenient
access methods, in particular GetSize() and GetWord(size_t pos). You can
thus obtain the sequence of words in the input. "Words" can contain
several factors in Moses. The factor with index 0 is typically the
surface form. Access it using the [] operator.
I guess you will never really want to work directly with the string
representation of the factor, but at this point you would be able to get
it and for instance print it to your debug output.
Hope this was helpful as another answer to your first question.
Cheers,
Matthias
On Wed, 2014-12-10 at 11:41 +0330, amir haghighi wrote:
> Hi everyone
>
>
>
> I'm implementing a feature function in moses-chart. I need the source
> words string and also their indexes in the source sentence. I've
> written a function that gets the source words but I don't know how
> extract word string from a word.
> could anyone guide me how to do that? as I know, each word is
> implemented as an array of factors, which of them is its string?
>
>
> I have also some questions about the states in the stateful features,
> what kind of variables should be stored in each state? only those ones
> that should be used in the compare function? or any variable from the
> previous hypothesis that we use in our feature?
>
>
> Thanks in advance!
>
>
> Cheers
>
> Amir
>
> _______________________________________________
> Moses-support mailing list
> Moses-support@mit.edu
> http://mailman.mit.edu/mailman/listinfo/moses-support
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
------------------------------
Message: 4
Date: Wed, 10 Dec 2014 21:34:44 +0900
From: Raj Dabre <prajdabre@gmail.com>
Subject: [Moses-support] When does this error message occur and how to
fix it
To: "moses-support@mit.edu" <moses-support@mit.edu>
Message-ID:
<CAB3gfjDNE5MuvC-mQcjQpnS0orBYCCwhSn63bk7ANtob=1igvQ@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Dear all,
I am using a JNI interface to the CPP code that reads from binary phrase
tables.
I get an error like: Mismatch between number of word penalties and number
of translation systems
This happens when I create 2 objects for reading from 2 different tables.
My understanding is that there is some problem with Static data but I am
not sure.
Can anyone help me ?
--
Raj Dabre.
Research Student,
Graduate School of Informatics,
Kyoto University.
CSE MTech, IITB., 2011-2014
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/mailman/private/moses-support/attachments/20141210/9e44c33a/attachment.htm
------------------------------
_______________________________________________
Moses-support mailing list
Moses-support@mit.edu
http://mailman.mit.edu/mailman/listinfo/moses-support
End of Moses-support Digest, Vol 98, Issue 28
*********************************************
Subscribe to:
Post Comments (Atom)
0 Response to "Moses-support Digest, Vol 98, Issue 28"
Post a Comment