Moses-support Digest, Vol 92, Issue 32

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: Feature function with variable number of scores (Hieu Hoang)
2. Re: Feature function with variable number of scores
(Marcin Junczys-Dowmunt)
3. Re: Feature function with variable number of scores (Hieu Hoang)
4. Re: Feature function with variable number of scores
(Marcin Junczys-Dowmunt)


----------------------------------------------------------------------

Message: 1
Date: Sat, 14 Jun 2014 19:11:59 +0100
From: Hieu Hoang <hieuhoang@gmail.com>
Subject: Re: [Moses-support] Feature function with variable number of
scores
To: Marcin Junczys-Dowmunt <junczys@amu.edu.pl>, moses-support
<moses-support@mit.edu>
Message-ID: <539C906F.5010208@gmail.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

the number of scores must be set in the feature function constructor,
there's no functionality to change it once its set

You might be better off using sparse features if you don't know how many
scores you have at construction time


On 14/06/14 09:17, Marcin Junczys-Dowmunt wrote:
> Hi,
> what's the trick for defining a feature function with a variable number
> of scores based on custom parameters in the ini-file?
> Just setting m_numScoreComponents = 2 in SetParameter(...) doesn't work.
> It seems the number of features is registered somewhere on object
> creation as I get the followiing message:
>
> Exception: moses/ScoreComponentCollection.cpp:242 in void
> Moses::ScoreComponentCollection::Assign(const Moses::FeatureFunction*,
> const std::vector<float>&) threw util::Exception'.
> Feature function EditOps0 specified 1 dense scores or weights. Actually
> has 2
>
> Thanks,
> Marcin
>
>
> _______________________________________________
> Moses-support mailing list
> Moses-support@mit.edu
> http://mailman.mit.edu/mailman/listinfo/moses-support
>



------------------------------

Message: 2
Date: Sat, 14 Jun 2014 20:19:51 +0200
From: Marcin Junczys-Dowmunt <junczys@amu.edu.pl>
Subject: Re: [Moses-support] Feature function with variable number of
scores
To: Hieu Hoang <hieuhoang@gmail.com>, moses-support
<moses-support@mit.edu>
Message-ID: <539C9247.2030305@amu.edu.pl>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Actually, I do know it at construction time. For instance I specify a
string "scores=mdis" in the ini, every character in the value
corresponds to one type of score, so I have 4 feature scores. Setting
again "num-features=4" is redundant now (I guess I can still do that,
but I don't like it). I see the number of scores is set in the low-level
function ParseLine in the FeatureFunction class, should I override
ParseLine in the inherited class then?

W dniu 14.06.2014 20:11, Hieu Hoang pisze:
> the number of scores must be set in the feature function constructor,
> there's no functionality to change it once its set
>
> You might be better off using sparse features if you don't know how
> many scores you have at construction time
>
>
> On 14/06/14 09:17, Marcin Junczys-Dowmunt wrote:
>> Hi,
>> what's the trick for defining a feature function with a variable number
>> of scores based on custom parameters in the ini-file?
>> Just setting m_numScoreComponents = 2 in SetParameter(...) doesn't work.
>> It seems the number of features is registered somewhere on object
>> creation as I get the followiing message:
>>
>> Exception: moses/ScoreComponentCollection.cpp:242 in void
>> Moses::ScoreComponentCollection::Assign(const Moses::FeatureFunction*,
>> const std::vector<float>&) threw util::Exception'.
>> Feature function EditOps0 specified 1 dense scores or weights. Actually
>> has 2
>>
>> Thanks,
>> Marcin
>>
>>
>> _______________________________________________
>> Moses-support mailing list
>> Moses-support@mit.edu
>> http://mailman.mit.edu/mailman/listinfo/moses-support
>>
>



------------------------------

Message: 3
Date: Sat, 14 Jun 2014 19:28:55 +0100
From: Hieu Hoang <Hieu.Hoang@ed.ac.uk>
Subject: Re: [Moses-support] Feature function with variable number of
scores
To: Marcin Junczys-Dowmunt <junczys@amu.edu.pl>
Cc: moses-support <moses-support@mit.edu>
Message-ID:
<CAEKMkbgdttyeUGdj=8eeHg=6R248_zDGnm=0yqin3O-8NKexWg@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

On 14 June 2014 19:19, Marcin Junczys-Dowmunt <junczys@amu.edu.pl> wrote:

> Actually, I do know it at construction time. For instance I specify a
> string "scores=mdis" in the ini, every character in the value corresponds
> to one type of score, so I have 4 feature scores. Setting again
> "num-features=4" is redundant now (I guess I can still do that, but I don't
> like it). I see the number of scores is set in the low-level function
> ParseLine in the FeatureFunction class, should I override ParseLine in the
> inherited class then?
>
let's not override ParseLine yet. I can't see what's wrong with
num-features=4
We need some kind of consistency


> W dniu 14.06.2014 20:11, Hieu Hoang pisze:
>
> the number of scores must be set in the feature function constructor,
>> there's no functionality to change it once its set
>>
>> You might be better off using sparse features if you don't know how many
>> scores you have at construction time
>>
>>
>> On 14/06/14 09:17, Marcin Junczys-Dowmunt wrote:
>>
>>> Hi,
>>> what's the trick for defining a feature function with a variable number
>>> of scores based on custom parameters in the ini-file?
>>> Just setting m_numScoreComponents = 2 in SetParameter(...) doesn't work.
>>> It seems the number of features is registered somewhere on object
>>> creation as I get the followiing message:
>>>
>>> Exception: moses/ScoreComponentCollection.cpp:242 in void
>>> Moses::ScoreComponentCollection::Assign(const Moses::FeatureFunction*,
>>> const std::vector<float>&) threw util::Exception'.
>>> Feature function EditOps0 specified 1 dense scores or weights. Actually
>>> has 2
>>>
>>> Thanks,
>>> Marcin
>>>
>>>
>>> _______________________________________________
>>> Moses-support mailing list
>>> Moses-support@mit.edu
>>> http://mailman.mit.edu/mailman/listinfo/moses-support
>>>
>>>
>>
>

--
Hieu Hoang
Research Associate
University of Edinburgh
http://www.hoang.co.uk/hieu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/mailman/private/moses-support/attachments/20140614/ae5a2427/attachment-0001.htm

------------------------------

Message: 4
Date: Sat, 14 Jun 2014 21:22:01 +0200
From: Marcin Junczys-Dowmunt <junczys@amu.edu.pl>
Subject: Re: [Moses-support] Feature function with variable number of
scores
To: Hieu Hoang <Hieu.Hoang@ed.ac.uk>
Cc: moses-support <moses-support@mit.edu>
Message-ID: <539CA0D9.2060403@amu.edu.pl>
Content-Type: text/plain; charset="utf-8"

Came up with something like that, still ugly, but works. num-features
can be specified too, and it will complain if it does not match the
length of "scores"

std::string ParseScores(const std::string &line, const std::string&
defaultScores) {
vector<string> toks = Tokenize(line);
UTIL_THROW_IF2(toks.empty(), "Empty line");

for (size_t i = 1; i < toks.size(); ++i) {
std::vector<std::string> args = TokenizeFirstOnly(toks[i], "=");
UTIL_THROW_IF2(args.size() != 2,
"Incorrect format for feature function arg: " << toks[i]);

if (args[0] == "scores") {
return args[1];
}
}
return defaultScores;
}

EditOps::EditOps(const std::string &line)
: StatelessFeatureFunction(ParseScores(line, "mdis").size(), line),
m_factorType(0), m_chars(false), m_scores(ParseScores(line, "mdis"))
{
std::cerr << "Initializing EditOps feature.." << std::endl;
ReadParameters();
}


W dniu 14.06.2014 20:28, Hieu Hoang pisze:
>
>
>
> On 14 June 2014 19:19, Marcin Junczys-Dowmunt <junczys@amu.edu.pl
> <mailto:junczys@amu.edu.pl>> wrote:
>
> Actually, I do know it at construction time. For instance I
> specify a string "scores=mdis" in the ini, every character in the
> value corresponds to one type of score, so I have 4 feature
> scores. Setting again "num-features=4" is redundant now (I guess I
> can still do that, but I don't like it). I see the number of
> scores is set in the low-level function ParseLine in the
> FeatureFunction class, should I override ParseLine in the
> inherited class then?
>
> let's not override ParseLine yet. I can't see what's wrong with
> num-features=4
> We need some kind of consistency
>
> W dniu 14.06.2014 20:11, Hieu Hoang pisze:
>
> the number of scores must be set in the feature function
> constructor, there's no functionality to change it once its set
>
> You might be better off using sparse features if you don't
> know how many scores you have at construction time
>
>
> On 14/06/14 09:17, Marcin Junczys-Dowmunt wrote:
>
> Hi,
> what's the trick for defining a feature function with a
> variable number
> of scores based on custom parameters in the ini-file?
> Just setting m_numScoreComponents = 2 in SetParameter(...)
> doesn't work.
> It seems the number of features is registered somewhere on
> object
> creation as I get the followiing message:
>
> Exception: moses/ScoreComponentCollection.cpp:242 in void
> Moses::ScoreComponentCollection::Assign(const
> Moses::FeatureFunction*,
> const std::vector<float>&) threw util::Exception'.
> Feature function EditOps0 specified 1 dense scores or
> weights. Actually
> has 2
>
> Thanks,
> Marcin
>
>
> _______________________________________________
> Moses-support mailing list
> Moses-support@mit.edu <mailto:Moses-support@mit.edu>
> http://mailman.mit.edu/mailman/listinfo/moses-support
>
>
>
>
>
> --
> Hieu Hoang
> Research Associate
> University of Edinburgh
> http://www.hoang.co.uk/hieu
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/mailman/private/moses-support/attachments/20140614/48609ab0/attachment.htm

------------------------------

_______________________________________________
Moses-support mailing list
Moses-support@mit.edu
http://mailman.mit.edu/mailman/listinfo/moses-support


End of Moses-support Digest, Vol 92, Issue 32
*********************************************

0 Response to "Moses-support Digest, Vol 92, Issue 32"

Post a Comment