Build something similar to sciSpacy, but say for another domain - spacy

I want to build a model similar to sciSpacy, but for another domain. How should I go about this?

You'll have to first make sure you have enough training data about your new domain. If you want to have a Named Entity Recognizer, you need texts annotated with named entities. If you want to have a parser, you need texts with dependency annotations. If you want a POS tagger, you need texts annotated with POS tags, etc.
Then you can create a new blank model, add the component(s) to them you need, and start training those:
nlp = spacy.blank("fr")
ner = nlp.create_pipe("ner")
nlp.add_pipe(ner)
ner.add_label("MY_DOMAIN_LABEL")
nlp.begin_training()
nlp.update(texts, annotations, drop=0.2)
This code snippet is not complete, because it really depends on what exactly it is you want to do. You can find more complete snippets in the documentation: https://spacy.io/usage/training
You might also be interested in the command-line utility to train new models, cf https://spacy.io/api/cli#train

Related

ArchUnit to test actual layered architecture

Currently in our project we have layered architecture implemented in following way where Controller, Service, Repository are placed in the same package for each feature, for instance:
feature1:
Feature1Controller
Feature1Service
Feature1Repository
feature2:
Feature2Controller
Feature2Service
Feature2Repository
I've found following example of arch unit test where such classes are placed in dedicated packages https://github.com/TNG/ArchUnit-Examples/blob/master/example-junit5/src/test/java/com/tngtech/archunit/exampletest/junit5/LayeredArchitectureTest.java
Please suggest whether there is possibility to test layered architecture when all layers are in single package
If the file name conventions are followed properly across your project, how about you write custom test cases instead of using layeredArchitecture().
For Example:
classes().that().haveSimpleNameEndingWith("Service")
.should().onlyBeAccessed().byClassesThat().haveSimpleNameEndingWith("Controller")
noClasses().that().haveSimpleNameEndingWith("Service")
.should().accessClassesThat().haveSimpleNameEndingWith("Controller")
I know this question is rather old. But for the record, this has been possible for a while using predicates for the layers, e.g.
layeredArchitecture().consideringAllDependencies()
.layer("Controllers").definedBy(HasName.Predicates.nameEndingWith("Controller"))
.layer("Services").definedBy(HasName.Predicates.nameEndingWith("Service"))
.layer("Repository").definedBy(HasName.Predicates.nameEndingWith("Repository"))
.whereLayer("Controllers").mayNotBeAccessedByAnyLayer()
.whereLayer("Services").mayOnlyBeAccessedByLayers("Controllers")
.whereLayer("Repository").mayOnlyBeAccessedByLayers("Services")
However, I'm not sure how well this works in practice. Because usually you don't just have classes following this naming pattern and that's it. A service might also have some POJO as method parameter type (e.g. MyInput) and that should maybe for example not be used by repositories as well. Also, using forward dependency rules (mayOnlyAccessLayers(..)) this might then cause unwanted violations.

How to only detect humans in object detection API Tensorflow

I am using tensorflow object detection API to detect objects. It is working fine in my windows system. How can I make changes in it to only detect mentioned objects, for example, I only want to detect humans and not all the objects.
As per the 1st comment in this answer, I have checked the visualization file but didn't find anything related to categories of objects. Then I looked into category_util.py and found out that there is csv file from which all the categories are being loaded but didnt found this csv file in the project. Can anyone please point me into the right direction. Thanks
I assume from your question, that you did not finetune your model yourself, but just used a pretrained one from the model zoo!?
In this case, I think the model already detect humans AND other objects and you want these other objects to disappear!? For doing so, you just have to change your label_map.pbtxt by deleting all classes which you don't need. If you are not sure where to find this file have a look into your .config file and search for label_map_path="PATH".

Multiple Ecore/EMF models in Eclipse plugin

Begin relative new to EMF I can only give sketch of what I want to do. The end product is a eclipse plug-in that have access to at least two EMF models. The first model is created by using Xtext to defined DSL. The second EMF is created using xtend code based on a ecore model.
My questions:
How to create a ecore model that will be visible in the plug in?
How to create an EMF instance of the ecore model using java/xtend when the code is executed in the plug in. The code snippets I find look like
val resourceSet = new ResourceSetImpl
val resource = resourceSet.getResource(URI.createURI(file), true)
but have no idea what the value of file must be to reference the ecore model.
any suggestion of how to translate the one EMF model to the other EMF model.
If I understand correctly, what you want to have is a model in your plug-in that's deployed in your end product. In that case you probably want to look at "platform:/plugin/..." URIs which you can probably use to retrieve artefacts from the running platform.
See URI.createURI(String) although you may want to look at URI.createPlatformPluginURI in your case
Search for Model-to-Model transformations, which you can specify with a variety of technologies (including Java, Xtend, ATL, etc.)

What rendering should i use for Multivariate Testing between Sublayouts in Sitecore

I Have numbers of sublayouts with them I want perform MVT in Sitecore .So i am not able to find which rendering should i use to perform the test .
I have taken reference of the article
Multivariate Testing for Sublayouts in Sitecore
But i want perform MVT between sublayouts .
Thank
I'm not sure if you are using OMS or DMS, so exact steps may be different. There's a quick thread on the subject on SDN:
http://sdn.sitecore.net/Forum/ShowPost.aspx?postid=28776
You will need to have different data sources defined for your sublayout, and have the data sources tied to test variables. From the link above:
Essentially, you need to change the datasource properties of the XSLT Rendering or Sublayout from Context item to your promotion item. You can do this with or without OMS. But for doing this as you describe and measuring the success of the test variables, follow these steps:
In Marketing Center, create the Multivariate test item. Define the Test Strategy (you can implement your own besides Random or Sticky).
Next, create the Multivariate Test Variables. Define a datasource for each variable. This is an item under your promotional folder. Remember to Name each test variable (name field).
For where the Promotional Sublayout is defined in presentation layout details settings, edit the control properties. In the dialog, select the multivariate test you previously created.
Publish your changes.

Rails Custom generators

Im building a custom generator for my app where I basically want to wrap around the Rails model generator. More specifically, I just want to change the model template being used (I want to add some methods that each model must implement).
Any pointers to the template to override or any other suggestions would be much appreciated.
EDIT:
Just to add, I dont want this to be the default model template, I want to be able to use it only when I use my generator
Some more mucking around and i found the answer. The active record model generator is here