Unable to match two entities without a whitespace on DialogFlow - machine-learning

I'm want to dialogflow to match the next sentence:
Search C1234567
Where the letter C is inside an entity and the 123456 (always integers) caught as number, I did what I'm showing you in the image below but seems that is not working. Do you know what could be happening?
Unable to Match
Just as a comment if I put an extra whitespace between the C and the number (123456) it works.
======================================
EDIT:
I also tryting adding three new entities:
This for the Char Char Entity
This one for the Numbers Numbers
And finally a composite entity like this Composite Entity
But as you can notice there is a space between the HPSM_Objects and Numbers entities in my TicketsHPSM entity, when i try to remove it I can't save the entity, and doing it with the whitespace DialogFlow just detect the examples inserted as phrases, for example Search C547854 is detected but it's not Search C524... Any idea?

Try and create a composite entity OR Enum entity as shown here. Then use this new entity to extract your C123456 all together in the parameters.

Related

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 Cypher Relationship syntax

https://neo4j.com/docs/developer-manual/current/get-started/cypher/#cypher-intro-patterns-relationship-syntax
The Neo4j Developer Manual section 2.2.1.2 describes the syntax for Relationships. I have a question regarding the 4th example as copied below.
-[role:ACTED_IN {roles: ["Neo"]}]->
What do the square brackets surrounding ["Neo"] denote? Is this the syntax for an array? If so, how do we identify the elements of this array?
Basically, I'm trying to understand the difference between the above relationship and the one below.
-[role:ACTED_IN {roles: "Neo"}]->
It is an array, you're matching an ACTED_IN relationship which has a property called roles whose value is an array with one String element equal to "Neo"
If you want to match any element in the array you would change this to
WHERE "Neo" IN role.roles
In the second example, you're matching a property called roles whose value is simply a String equalling "Neo"

Adding relationship to existing nodes with Cypher doesn't work

I am working on Panama dataset using Neo4J graph database 1.1.5 web version. I identified Ion Sturza, former Prime Minister of Moldova on the database and want to make a map of his related network. I used following code to query using Cypher (creating a variable 'IonSturza'):
MATCH (IonSturza {name: "Ion Sturza"}) RETURN IonSturza
I identified that the entity 'CONSTANTIN LUTSENKO' linked differently to entities like 'Quade..' and 'Kinbo...' with a name in small letters as in this picture. I hence want to map a relationship 'SAME_COMPANY_AS' between the capslock and the uncapped version. I tried the following code based on this answer by #StefanArmbruster:
MATCH (a:Officer {name :"Constantin Lutsenko"}),(b:Officer{name :
"CONSTANTIN LUTSENKO"})
where (a:Officer{name :"Constantin Lutsenko"})-[:SHAREHOLDER_OF]->
(b:Entity{id:'284429'})
CREATE (a)-[:SAME_COMPANY_AS]->(b)
Instead of indexing, I used the 'where' statement to specify the uncapped version which is linked only to the entity bearing id '284429'.
My code however shows the cartesian product error message:
This query builds a cartesian product between disconnected patterns.If a part of a query contains multiple disconnected patterns, this will build a cartesian product between all those parts. This may produce a large amount of data and slow down query processing. While occasionally intended, it may often be possible to reformulate the query that avoids the use of this cross product, perhaps by adding a relationship between the different parts or by using OPTIONAL MATCH (identifier is: (b))<<
Also when I execute, there are no changes, no rows!! What am I missing here? Can someone please help me with inserting this relationship between the nodes. Thanks in advance!
The cartesian product warning will appear whenever you're matching on two or more disconnected patterns. In this case, however, it's fine, because you're looking up both of them by what is likely a unique name, s your result should be one node each.
If each separate part of that pattern returned multiple nodes, then you would have (rows of a) x (rows of b), a cartesian product between the two result sets.
So in this particular case, don't mind the warning.
As for why you're not seeing changes, note that you're reusing variables for different parts of the graph: you're using variable b for both the uppercase version of the officer, and for the :Entity in your WHERE. There is no node that matches to both.
Instead, use different variables for each, and include the :Entity in your match. Also, once you match to nodes and bind them to variables, you can reuse the variable names later in your query without having to repeat its labels or properties.
Try this:
MATCH (a:Officer {name :"Constantin Lutsenko"})-[:SHAREHOLDER_OF]->
(:Entity{id:'284429'}),(b:Officer{name : "CONSTANTIN LUTSENKO"})
CREATE (a)-[:SAME_COMPANY_AS]->(b)
Though I'm not quite sure of what you're trying to do...is an :Officer a company? That relationship type doesn't quite seem right.
I tried the answer by #InverseFalcon and thanks to it, by modifying the property identifier from 'id' to 'name' and using the property for both 'a' and 'b', 4 relationships were created by the following code:
MATCH (a:Officer {name :"Constantin Lutsenko"})-[:SHAREHOLDER_OF]->
(:Entity{name:'KINBOROUGH PORTFOLIO LTD.'}),(b:Officer{name : "CONSTANTIN
LUTSENKO"})-[:SHAREHOLDER_OF]->(:Entity{name:'Chandler Group Holdings Ltd'})
CREATE (a)-[:SAME_NAME_AS]->(b)
Thank you so much #InverseFalcon!

Trying to replace this block-based NSSortDescriptor with a Core Data-friendly one

I've got an entity type which, as one of its properties, has a single character. I want to retrieve all such entities which match a predicate, and I want them to be sorted first by that character, and then by an index number (which is another of its properties).
This is simple if I just use the built-in sort descriptors... however, the single character can be anything from a letter to a number to punctuation to an emoji. And when I use the built-in sort, I get punctuation first, then numbers, and then so on. What I want is A-Z first, then numbers, then punctuation, then finally emoji or other non-alphanumeric-and-non-punctuation (those last ones I don't really care about their order).
This is easy enough to implement as a block-based NSSortDescriptor, but I can't figure out how to do it in a way that I can send it off to Core Data as part of a fetch request (i.e., no blocks allowed). I'd be fine with breaking it into a couple different requests, if that's the only way to do it, and then joining the resulting arrays afterward; but I'd prefer to do it in one fetch if possible.
Thanks!
When you create the objects in the first place, run your sort logic and save a resulting 'characterType' into another property. Now, on your fetch request, use 3 sort descriptors, with this character type identifier first, then the character and then the other index.

Hadoop join with String key

I'm implementing a reduce-side join to find matches between databases A and B. Both files from the datasets contains a json object per line. The join key is the name attribute of each record, so, the mapper extract the name of the json and pass it as key and the json itself as value. The reducer must merge the jsons objects for the same or similar person name.
The problem is that I need to group keys using a string similarity matching algorithm, e.g., John White must be considered equal to John White Lennon.
I've tried to do that using a grouping comparator but it is not working as expected.
How can this be implemented?
Thanks in advance!
What you request here could be described as a set similarity join, where the sets are, e.g. the sets of tokens, or n-grams of each line. Here is a research paper, that describes how you can achieve that in MapReduce. I hope you find it useful.

Resources