anystyle icon indicating copy to clipboard operation
anystyle copied to clipboard

Using multiple Training models in the same application

Open dominic01 opened this issue 4 years ago • 3 comments

I am trying to create a different model for German references. Couple of years back (#72 )I had checked here but did not use it. Kindly let me know how to do it in the latest version?

dominic01 avatar Jul 20 '20 11:07 dominic01

You can create different parser instances, based on different models, normalizers, etc. AnyStyle::Parser.new model: './german.mod'

inukshuk avatar Jul 20 '20 13:07 inukshuk

In my current setup I have a simple service running. Is it a correct way of creating a parser instance and using it. Sorry I am not a ruby person and I am learning.

enparser = AnyStyle::Parser.new model: './en.mod'
deparser = AnyStyle::Parser.new model: './de.mod'

loop through the list
		dataset = enparser.parse("my english reference here", format: :wapiti)
		puts dataset.to_xml;

		dataset = enparser.parse("my german reference here", format: :wapiti)
		puts dataset.to_xml;
end loop

If I have the AnyStyle::Parser inside the loop, then does it create the parser instance every time.

dominic01 avatar Jul 20 '20 17:07 dominic01

This looks good. The .new call creates a new parser instance.

inukshuk avatar Jul 20 '20 19:07 inukshuk