"Including files in the extension Build"
Hi there!
I'm currently making an extension for Part-of-Speech-Taggers and to initialize an operator with its tagger, it needs a model file (*.tagger).
So i have 2 questions, because the Gradle documentation isn't really helping me there:
1. How can i include a file in the build, so that the extension has an exact copy of it?
2. What is the Adress of the File? The tagger needs to know where it is placed (with an argument like "path/to/file/xyz.tagger")
Obviously i cant just expect from a user to have the model files on him and specify them, they have to come with the extension.
Thanks,
Phil
Best Answer
-
jczogalla Employee-RapidMiner, Member Posts: 144 RM Engineering
Hi @s1phscho
So if I understand correctly, you have a simple file that needs to be available at runtime.
You can add the file to your src/main/resources folder, preferably under com/rapidminer/extension(/resources). That makes sure the file will be packaged with the jar file. If you put the file there, say "com/rapidminer/extension/resources/model.tagger", you can access it at runtime using Class.getResource to retrieve an url/input stream of that file using the path in quotes (plus/minus a leading "/").
If you need it as a file, you can copy it to the extensions workspace, that you can find by using FileSystemService.getPluginRapidMinerDir. You can copy the file there, then reference it later. As Martin pointed out, your PluginInit class should be used to do that. The first hook is called before any operators are initialized/registered.
I hope this helps! Cheers
Jan
6
Answers
Hi,
would it be fine to have a sample repository with these options? Much like the usual Sample Data (Golf...) in RapidMiner?
BR,
Martin
Dortmund, Germany
That would make a solution, but it would be neither clean, nor convenient. the operator is supposed to hold the model files when it is initialized, because the tagger can't load without it.
Phil
Hi Phil,
okay, i guess this all needs to be done in the plugin init. Since i am not aware that we are doing it somewhere, i can't help directly. But i am sure our studio gurus like @jczogalla can.
Will you publish it on market place? I am happy to sign up as a beta tester
Grüße aus Dortmund,
Martin
Dortmund, Germany
Or operator constructor, respectively. The main problem is, that this file needs to be in the installed extension somewhere.
Probably, but There will be a full NLP library, which other people will be working on too (each Part is its own Bachelor Thesis). If and when it is going to be published, is going to be decided by the Chair we are writing for
Phil
Hi,
The PluginInti ... .java has functions which are called when the extension is loaded (at splash screen). You can of course add code here which downloads files and puts them into the .RapidMiner folder. You can pic them up during execution. There should be some way to reference the .RapidMiner folder.
As i said, i am not an expert here. Let's wait for our dev team to respond.
Cheers,
Martin
Dortmund, Germany