Hey William, thank you very much for the provided example.
So if I understand everything correctly, I call the DefaultPOSContextGenerator.java class where all the logic concerning the context is set? In my text examples, I have 4 different types of patterns. With the context generator I can set these different patterns right? Is there also an example for this? I give you one of my patterns as an example: SALIX BO 99.625-100.125 5x5 LZ135984 73553NBE7 SLXP So is it possible to define this type of pattern in the POSContextGenerator? Like saying the first two are text, then followed by numbers etc. And can you also difine the length of it? I used my own POS-Tags for these task. Sorry for these hugh amount of questions! And thank you very much for your help!!! I appreciate it very much. Best regards, Max ---------------------------------------------------------------------------------------------------------------- You tried to use the CachedFeatureGenerator, which is specific to the NameFinder module. I wrote a very simple example for you. It is compatible with OpenNLP 1.6.0-SNAPTSHOT (SVN trunk) or with the 1.6.0 RC2 ( http://comments.gmane.org/gmane.comp.apache.opennlp.devel/1161). The example suggests using the Factory approach, which is more flexible and safer. The model is compatible with the command line tools. https://gist.github.com/wcolen/3d01e2949faad71256a0 Regards, William 2015-02-18 11:16 GMT-02:00 Max Richter <[email protected]>: > Hey William, > > thank you for your answer. I know have it running using the API. > But it is somewhere a little criptic to me. > This is what the example provides for the default generator: > > AdaptiveFeatureGenerator featureGenerator = new CachedFeatureGenerator( > new AdaptiveFeatureGenerator[]{ > new WindowFeatureGenerator(new TokenFeatureGenerator(), 2, 2), > new WindowFeatureGenerator(new TokenClassFeatureGenerator(true), 2, > 2), > new OutcomePriorFeatureGenerator(), > new PreviousMapFeatureGenerator(), > new BigramNameFeatureGenerator(), > new SentenceFeatureGenerator(true, false) > }); > > I also found the discription of the single classes under: > > https://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/util/featuregen/ > > But do you have any real example of using the feature generator to get a > better feeling how to use each class? > This would be very helpful. > > Thank you! > Max > > ---------------------------------------- > I did not found any option to reply to the mail in the archive so I post > the mails here too, so that you can add it. > > Thanks, Max > > William Colen <[email protected]> > Re: Custom Feature Generation with POS > Fri, 13 Feb 2015 17:46:32 GMT > > > Hi, yes, there is are two possibilities. The easy way is using the API, > > where you can pass the feature generator in the constructor of the > trainer > > and runtime. You must be careful to always use the same feature > generator. > > The other which is more flexible, is to create a custom factory that > > provides the feature generator. This last option is only available in > 1.5.3 > > or latter. > > > Regards, > > William > > 2015-02-10 12:09 GMT-02:00 Max Richter <[email protected]>: > > > Hello, > > > > I would like to write my own feature generator which I want to use with > > the openNLT POS-Tagger. > > Is this in principle possible? Because in the documentation it was only > > mentioned in context with the NER. > > > > Is there also some more detailed example on how to construct an custom > > feature generator? > > > > Thank you for your help, > > Max > > >
