anystyle
anystyle copied to clipboard
Using multiple Training models in the same application
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?
You can create different parser instances, based on different models, normalizers, etc. AnyStyle::Parser.new model: './german.mod'
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.
This looks good. The .new
call creates a new parser instance.