How to process two entities with the same value in API.ai - machine-learning

I am using API.ai as NLP input interface, when i am typing
"I am having rice"
It should process two entities fooditem and foodtiming
I have created these two entities and also mapped rice with these two entites,
but while typing this command it takes only one entity value

Related

How much data / context needed to train custom NER Spacy model?

I am trying to extract previous Job titles from a CV using spacy and named entity recognition.
I would like to train spacy to detect a custom named entity type : 'JOB'. For that I have around 800 job title names from https://www.careerbuilder.com/browse/titles/ that I can use as training data.
In my training data for spacy, do I need to integrate these job titles in sentences added to provide context or not?
In general in the CV the job title kinda stands on it's own and is not really part of a full sentence.
Also, if I need to provide coherent context for each of the 800 titles, it will be too time-consuming for what I'm trying to do, so maybe there are other solutions than NER?
Generally, Named Entity Recognition relies on the context of words, otherwise the model would not be able to detect entities in previously unseen words. Consequently, the list of titles would not help you to train any model. You could rather run string matching to find any of those 800 titles in CV documents and you will even be guaranteed to find all of them - no unknown titles, though.
I you could find 800 (or less) real CVs and replace the Job names by those in your list (or others!), then you are all set to train a model capable of NER. This would be the way to go, I suppose. Just download as many freely available CVs from the web and see where this gets you. If it is not enough data, you can augment it, for example by exchanging the job titles in the data by some of the titles in your list.

ENTITIES matching conflicting in LUIS

I have two entities created in LUIS. One entity to identify the AlphaNumeric word and another one to identify a word with a pattern. Both entities are created using a regular expression.
To identify alphanumeric I used - \w+\d+ regular expression.
To identify the word with a pattern I used - ^venid\d+ (words like venid12345, venid32310...)
These two entities are mapped to two different INTENTS. But actually how much I trained the LUIS, still the first entity is only getting recognized. How to overcome this?
Add the regex entities from Entities tab and train the app, then add utterances from the intents tab for the respective intent. This should enable the model to pickup the regex entities irrespective of the mapping. Here is a screen shot of both these entities getting recognized for some alphanumeric patterns.
numericalpha is the first pattern and vendor is the second pattern that i have added in the LUIS app.

Neo4j OGM Filter query against array

I'm trying to build a small property searching system. I'm using spring boot with a neo4j database and I'm trying to query from the neo4j database using filters becasue i need the querying to be dynamic too. In my use case properties has features such as electricity, tap water, tilled roof, etc. Property & Feature are nodes, Feature node has an attribtue named 'key', a Property node is linked to many Feature nodes by rich relationships typed HAS_FEATURE, what i want to do is query properties for a given array of feature keys using Filters. Follwing is code,
featureKeys is a java List here,
filter = new Filter("key", ComparisonOperator.IN, featureKeys);
filter.setRelationshipType("HAS_FEATURE");
filter.setNestedPropertyName("hasFeatures");
filter.setNestedPropertyType(Feature.class);
filters.add(filter);
SESSION.loadAll(Property.class, filters, new Pagination(pageNumber, pageSize));
The problem is i want only the properties that related to all the given features keys to be returned, but even the properties that is related to one element of the given feature key list is also returned. What do i need to do to query only the properties that are linked to all the given list elements, i can change the rich relationship to a normal relationship if needed.

enlarging a text corpus with classes

I have a text corpus of many sentences, with some named entities marked within it.
For example, the sentence:
what is the best restaurant in wichita texas?
which is tagged as:
what is the best restaurant in <location>?
I want to expand this corpus, by taking or sampling all the sentences already in it, and replacing the named entities with other similar entities from the same types, e.g. replacing "wichita texas" with "new york", so the corpus will be bigger (more sentences) and more complete (number of entities within it). I have lists of similar entities, including ones which doesn't appear in the corpus but I would like to have some probability of inserting them in my replacements.
Can you recommend on a method or direct me to a paper regarding this?
For your specific question:
This type of work, assuming you have an organized list of named entities (like a separate list for 'places', 'people', etc), generally consists of manually removing potentially ambiguous names (for example, 'jersey' could be removed from your places list to avoid instances where it refers to the garment). Once you're confident you removed the most ambiguous names, simply select an appropriate tag for each group of terms ("location" or "person", for instance). In each sentence containing one of these words, replace the word with the tag. Then you can perform some basic expansion with the programming language of your choice so that each sentence containing 'location' is repeated with every location name, each sentence containing 'person' is repeated with every person name, etc.
For a general overview of clustering using word-classes, check out the seminal Brown et. al. paper: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.13.9919&rep=rep1&type=pdf

Does Neo4j support constraints based on a domain-model?

Short question
Does Neo4j support constraints based on a domain-model?
Explanation
In the basic tutorial, it says "Please keep this picture at hand all the time. It details the domain-model for this tutorial." (https://stack.versal.com/api2/assets/fdc05cea-e18b-44ea-8ba9-e119d7a8f872).
But is there any way to check that data stored into the graph respect this domain-model?
For relational databases, we have "create" instructions to build the domain-model and "insert" instructions to store data in compliance with this domain-model.
For graph database in Neo4j, I only found "create" instructions where we can specify a type (that would be part of the domain-model).
What I need to do
I need to create a domain-model that prevent the creation of nodes which are not compliants with the domain-modeln for example:
the node type must be in the domain-model
a type of association can only link nodes with specific types
Example
With the movie domain-model coming from the tutorial (https://stack.versal.com/api2/assets/fdc05cea-e18b-44ea-8ba9-e119d7a8f872) :
A node can only be of type Person or Movie
A Movie can't have outgoing edges
A DIRECTED or ACTED_IN relationship can't link two Persons
...
Is this possible in Neo4j?
Or do I have to create checkers on the model?
You will have to create checkers of the model or an API that guarantees that only nodes matching the model are added.
Some things that you describe will be added in Neo4j in the future but it has not been decided when.
But I saw a presentation of the http://structr.org application framework today that allows you to model a schema with types, properties and relationships with cardinalities.

Resources