opennlp-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joern Kottmann <kottm...@gmail.com>
Subject Re: Cache
Date Tue, 05 Sep 2017 20:27:27 GMT
The feature generators are not thread safe, so it is ok to use an
instance variable for caching.
We have some feature generators which do that.

Jörn

On Tue, Sep 5, 2017 at 9:19 PM, Daniel Russ <druss@apache.org> wrote:
> Again, you should send this to users not dev mail list.
>
> Have you tried adding an instance variable  (e.g.  numWords) that you update when you
call “createFeature”? You need to be concerned with thread safety if you do this on more
than 1 thread, but you can synchronize only the part of the code that adds to the instance
variable.  You should also be careful to create 1 instance of the AdaptiveFeatureGenerator.
>
> you might also consider resetting the value in the clearAdaptiveData method.  However,
that might not work for you and you may need a method to reset your feature.
>
> Let me know if that works for you….
>
> Daniel
>
>> On Sep 5, 2017, at 6:48 AM, Manoj B. Narayanan <manojb.narayanan2011@gmail.com>
wrote:
>>
>> Hi,
>>
>> Could anyone please help me out.
>>
>> Thanks,
>> Manoj
>>
>> On Wed, Aug 30, 2017 at 10:47 AM, Manoj B. Narayanan <
>> manojb.narayanan2011@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> While training a NER model I use provide custom features by implementing *AdaptiveFeatureGenerator.
>>> *In the implementing class I compute certain features and add them. When
>>> I have another implementing class for adding features, I compute the
>>> features which sometimes are computed in the first implementing class
>>> itself. I am not aware of a mechanism where I can use the information from
>>> the first implementing class without computing them again.
>>>
>>> So, if there is a way where I could store some information about a
>>> sentence in a global manner, I would be able to get them in all the classes
>>> I need without computing them.
>>>
>>> If there is a provision for this already, please guide me. Else, I put
>>> forth this as a suggestion/request.
>>>
>>> Thanks,
>>> Manoj.
>>>
>>>
>>>
>

Mime
View raw message