opennlp-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Damiano Porta <damianopo...@gmail.com>
Subject Re: Custom Features Generator example
Date Tue, 25 Oct 2016 10:43:00 GMT
Joern,
However i also tried with:

    public SpanFeatureGenerator(Map<String, String> properties,
FeatureGeneratorResourceProvider resourceProvider) throws
InvalidFormatException {

    }

but i get the same exception.
Damiano

2016-10-25 12:30 GMT+02:00 Damiano Porta <damianoporta@gmail.com>:

> This at the moment:
>
> public SpanFeatureGenerator(String prefix, Object finder, int
> prevWindowSize,  int nextWindowSize) {
>
>         System.out.println(prefix);
>         System.out.println((String)finder);
>         System.out.println(prevWindowSize);
>         System.out.println(nextWindowSize);
>         System.exit(1);
>
> }
>
> It is obviously a test to understand if my generator is called.
>
>
> 2016-10-25 12:23 GMT+02:00 Joern Kottmann <kottmann@gmail.com>:
>
>> What is the constructor of the
>> com.damiano.parser.generator.SpanFeatureGenerator
>> class?
>>
>> Jörn
>>
>> On Tue, Oct 25, 2016 at 11:51 AM, Damiano Porta <damianoporta@gmail.com>
>> wrote:
>>
>> > Hello,
>> > I have created a custom generator implementing the
>> AdaptiveFeatureGenerator
>> > interface.
>> >
>> > I am getting this error:
>> >
>> > Exception in thread "main"
>> > opennlp.tools.util.ext.ExtensionNotLoadedException:
>> > java.lang.InstantiationException:
>> > com.damiano.parser.generator.SpanFeatureGenerator
>> > at
>> > opennlp.tools.util.ext.ExtensionLoader.instantiateExtension(
>> > ExtensionLoader.java:72)
>> > at
>> > opennlp.tools.util.featuregen.GeneratorFactory$
>> > CustomFeatureGeneratorFactory.create(GeneratorFactory.java:582)
>> > at
>> > opennlp.tools.util.featuregen.GeneratorFactory.createGenerator(
>> > GeneratorFactory.java:661)
>> > at
>> > opennlp.tools.util.featuregen.GeneratorFactory$
>> > AggregatedFeatureGeneratorFactory.create(GeneratorFactory.java:129)
>> > at
>> > opennlp.tools.util.featuregen.GeneratorFactory.createGenerator(
>> > GeneratorFactory.java:661)
>> > at
>> > opennlp.tools.util.featuregen.GeneratorFactory$
>> > CachedFeatureGeneratorFactory.create(GeneratorFactory.java:171)
>> > at
>> > opennlp.tools.util.featuregen.GeneratorFactory.createGenerator(
>> > GeneratorFactory.java:661)
>> > at
>> > opennlp.tools.util.featuregen.GeneratorFactory$
>> > AggregatedFeatureGeneratorFactory.create(GeneratorFactory.java:129)
>> > at
>> > opennlp.tools.util.featuregen.GeneratorFactory.createGenerator(
>> > GeneratorFactory.java:661)
>> > at
>> > opennlp.tools.util.featuregen.GeneratorFactory.create(
>> > GeneratorFactory.java:711)
>> > at
>> > opennlp.tools.namefind.TokenNameFinderFactory.createFeatureGenerators(
>> > TokenNameFinderFactory.java:153)
>> > at
>> > opennlp.tools.namefind.TokenNameFinderFactory.createContextGenerator(
>> > TokenNameFinderFactory.java:118)
>> > at opennlp.tools.namefind.NameFinderME.train(NameFinderME.java:333)
>> > at com.damiano.parser.trainer.NER.compileNER(NER.java:161)
>> > at com.damiano.parser.trainer.NER.main(NER.java:136)
>> >
>> > Caused by: java.lang.InstantiationException:
>> > com.damiano.parser.generator.SpanFeatureGenerator
>> > at java.lang.Class.newInstance(Class.java:427)
>> > at
>> > opennlp.tools.util.ext.ExtensionLoader.instantiateExtension(
>> > ExtensionLoader.java:70)
>> > ... 14 more
>> >
>> > Caused by: java.lang.NoSuchMethodException:
>> > com.damiano.parser.generator.SpanFeatureGenerator.<init>()
>> > at java.lang.Class.getConstructor0(Class.java:3082)
>> > at java.lang.Class.newInstance(Class.java:412)
>> > ... 15 more
>> >
>> > the xml is:
>> >
>> > <generators>
>> >   <cache>
>> >     <generators>
>> >       <window prevLength="6" nextLength="3">
>> >         <tokenclass/>
>> >       </window>
>> >       <window prevLength="6" nextLength="3">
>> >         <token/>
>> >       </window>
>> >       <definition/>
>> >       <prevmap/>
>> >       <bigram/>
>> >       <sentence begin="true" end="false"/>
>> >       <custom class="com.damiano.parser.generator.SpanFeatureGenerator"
>> > prefix="name" finder="blablabla" prevWindowSize="3" nextWindowSize="3"/>
>> >     </generators>
>> >   </cache>
>> > </generators>
>> >
>> > What can i do?
>> > Thank you!
>> >
>> > Damiano
>> >
>>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message