I can't wrap everything there. The validSequence method is called for each word in the sentence. But to generate the sequence of sets of possible outputs I just need to loop once through the input sentence, before anything else, and store these in an instance, and then use them. So, this is what I did right now, I implemented the SequenceValidator. I am reading the sequence of posibilities from a static variable in the validSequence method. I am setting the static variable before every tagging call... but this can't really be considered wrapping. This is not healthy coding, in my opinion.
But yes, if there was a way to feed in my own sequence validator, I wouldn't have had to modify the api. So, your suggestion would work for my case. I was just saying that I am not sure if it is the best solution, in terms of code organizing. Radu ________________________________ From: Jörn Kottmann <[email protected]> To: [email protected] Sent: Tue, March 15, 2011 5:22:24 PM Subject: Re: Hybrid POS tagger On 3/15/11 4:01 PM, Radu Simionescu wrote: > I do not store the sequences of possible sets of outcomes. I generate them at > runtime based on a dictionary and disambiguation rules(applied on the given > input sentence). So for my case, I needed a method like tagger.tag(String[] > sentence, String[][] possible_outcomes_for_each_word). Where > possible_outcomes_for_each_word is generated by some code which is not related > to OpenNLP. where sentence.length() = possible_outcomes_for_each_word.length > That is exactly where the sequence validation is for. Couldn't you wrap your validation mechanism inside a sequene validator? There you get the full sentence and the current partial sequence. Jörn
