Why does the URLGetRelations API mislabel some sentences as "future" tense? - ibm-watson

I'm hoping to use the URLGetRelations API to help identify sentences in text that are future tense. However, I’ve seen inaccuracies in sentences the API is identifying as future tense. Examples below, all identified as "future" but these are arguably incorrect. I see in the API responses below that there are some garbled words (e.g. "revivehim" from the first article), maybe this is causing the mislabeling? If you look at the URLs I've directed the APIs to, though, the distortions are not present in the original source text.
One from: http://www.reuters.com/article/new-york-police-idUSL2N15R02C
{ "sentence": " \"Oh my God,someone's hit,\" a tearful Liang recalled
saying upon finding a bleedingGurley lying on a landing, as his
girlfriend frantically tried to revivehim.", "subject": { "text": "his
girlfriend"}, "action": { "text": "tried to revive","lemmatized": "try
to revive", "verb": {"text": "revive", "tense": "future" } },"object":
{ "text": "him","sentimentFromSubject": { "type": "negative","score":
"-0.70197" } } },
Two from: http://www.cnn.com/2016/02/11/us/nypd-officer-trial/
{ "sentence": " On Thursdayevening, about an hour before the verdict,
the jury asked Justice Danny Chun toread them the charges and legal
definitions, the second time this week.","subject": { "text": "Justice
Danny Chun" },"action": { "text": "to read","lemmatized": "to read",
"verb": {"text": "read", "tense": "future" } },"object": { "text":
"the charges and legaldefinitions", "sentiment": { "type":"negative",
"score": "-0.597878" } } },

I think it's the word "to" that is causing this confusion. It's very common to see future tense verb phrases that include the word "to", such as "I am going to eat that later" and "We are planning to fly tonight." You also see phrasing like "Joe to appear on TV tonight" that implies future tense even if it isn't 100% grammatically correct. In the cases you shared, the word "to" is acting to form an infinitive, but because of the very similar structure to future tense verb phrases they are being classified as future tense. It's especially easy to see how this is happening with the second example: the subject is "Justice Danny Chun", the action is "to read", and the object is "the charges...". The system is seeing this as one sentence that reads as "Justice Danny Chun to read the charges", which gives us future tense.

Related

React.js: array.map/forEach wont print on screen but console.log works

I have a function that needs to find nearest parent id, the result is in an object so I convert it to array then when I loop through the array and need to display it, it doesnt work. but when I check using console.log it is working fine. Any advice?
function findParentsProject(brands, id, parent = null) {
for (let brand of brands) {
const result =
brand.id === id
? parent
: brand.projects && findParentsProject(brand.projects, id, brand);
if (result) {
var list = Object.values(result.projects);
return list.forEach((project, index) => {
//console.log(project.name)
<p>{project.name}</p>;
});
}
}
}
this is the result if comment out the console.log
console.log
here is the data(brands):
{
"projects": [
{
"id": 1,
"name": "project 1",
"typeOfWork": "Brand Identity",
"brandDetails": "Strategy and brand id entity for the ambitious online art retailer",
"Awards": "MARKies Awards 2021",
"AwardDetails": "Most Creative Audio (Bronze)",
"Content": "While this competition is healthy, it often means that competitors tend to produce similiar posts, thus drowning in the ocean of posts that in social media. How do make Allianz unique so it stands out more among the crowd, without so much resorting to pay-to-win?"
},
{
"id": 2,
"name": "project 2",
"typeOfWork": "Editorial & Prints",
"brandDetails": "Strategy and brand id entity for the ambitious online art retailer",
"Awards": "MARKies Awards 2021",
"AwardDetails": "Most Creative Audio (Bronze)",
"Content": "While this competition is healthy, it often means that competitors tend to produce similiar posts, thus drowning in the ocean of posts that in social media. How do make Allianz unique so it stands out more among the crowd, without so much resorting to pay-to-win?"
},
{
"id": 3,
"name": "project 3",
"typeOfWork": "Digital Design",
"brandDetails": "Strategy and brand id entity for the ambitious online art retailer",
"Awards": "MARKies Awards 2021",
"AwardDetails": "Most Creative Audio (Bronze)",
"Content": "While this competition is healthy, it often means that competitors tend to produce similiar posts, thus drowning in the ocean of posts that in social media. How do make Allianz unique so it stands out more among the crowd, without so much resorting to pay-to-win?"
}
]
}

Fix data post API call to fix inconsistencies, like typos?

Ok, so this is going to be a complicated question, I hope I'm clear. Full admission, I just finished a Bootcamp yesterday so I'm not aware of a lot of technologies out there, and I think I may need additional technologies to accomplish what I'm looking for...
Right now, I have an application that uses bandsintown API call to populate a database. What I've noticed is that bandsintown isn't consistent with their data returns in each object, which makes operations after retrieving the objects difficult/seemingly impossible. An example would be that different artists performing at the same venue returns different latitude, longitude, venue name, etc. Examples:
Here is Primus playing at Bonnaroo:
{
"offers": [],
"venue": {
"country": "United States",
"city": "Manchester",
"latitude": "35.4839582",
"name": "Bonnaroo Music and Arts Festival 2020",
"location": "",
"region": "TN",
"longitude": "-86.08963169999998"
},
"datetime": "2020-09-25T12:00:00",
"on_sale_datetime": "",
"description": "",
"lineup": [
"Primus"
],
"bandsintown_plus": false,
"id": "1020701795",
"title": "",
"artist_id": "1263",
"url": "https://www.bandsintown.com/e/1020701795?app_id=451f31b2808001d069daed45c32a9dac&came_from=267&utm_medium=api&utm_source=public_api&utm_campaign=event"
}
compared to The Weeknd playing at Bonnaroo:
{
"id": "18604416",
"url": "https://www.bandsintown.com/e/18604416?app_id=451f31b2808001d069daed45c32a9dac&came_from=267&utm_medium=api&utm_source=public_api&utm_campaign=event",
"datetime": "2017-05-17T19:00:00",
"title": "",
"description": "",
"venue": {
"location": "",
"name": "Bonnaroo",
"latitude": "35.476247",
"longitude": "-86.081026",
"city": "Manchester",
"country": "United States",
"region": "TN"
},
"lineup": [
"The Weeknd"
],
"offers": [],
"artist_id": "1371750",
"on_sale_datetime": "",
"bandsintown_plus": false
}
My issue is now I wish to aggregate and $group in MongoDB because both events were at Bonnaroo, but the Object{venue.name} is not the same... Even the latitude & longitude is different so I can't use those either. I'm wondering if there is a way to alter the data of the objects automatically without having to go into the DB and edit individual objects. Both these events include the word Bonnaroo, so could I have something find and match text and then slice out the text that isn't similar? If so, can I then use the matched venue name field as a reference to change the latitude & longitude values too?
I hope I was clear, feel free to ask any clarifying questions if I wasn't. This site has helped me so many times and I appreciate all the hard work the community puts in to help each other! Thanks ahead of time!
~~~EDIT~~~
Thanks for the first reply #morad takhtameshloo.
So I was able to build something before I saw your reply that splits the data into an array, which is along the same lines as what you offered. The only thing that won't work is the $arrayToElem with the index cause there are some venues that:
Have multiple-word names (e.g. The Stone Pony)
Have words before the actual venue name (saw it in one result that was like
"Verizon Live Presents at The Stony Pony")
Using this Bonnaroo example, I have the new field returning every word as a value in the array:
"venueName": ["Bonnaroo", "Music", "and","Arts","Festival","2020"]
My next step is going to be to compare the [venueName] of the 'Primus' object and the 'The Weeknd' object, find what values in the array are the same, and return them back to the value of "venueName".
Hope this makes more sense, I appreciate your input!
actual the trick depends to your data, you should provide more data if the ones you've provided does not depict the whole problem
in other words how deep you want to dive in.
for the dumbest answer, at least for the data you've provided
db.prod4.aggregate([
{
$addFields: {
venueName: {
$arrayElemAt: [{ $split: ['$venue.name', ' '] }, 0],
},
},
},
])
but that not the case of course, something that comes to mind is that venue's geolocations for the same venue should not be far away from each other, for instance, the data you've provided two locations are in 1.16 KM of each other.
so another dummy solution that works would be writing a simple script that selects a random element from the array of all data, and finds data that their lat/lng is for example in 2km of that point, and removes those elements from array and selects another random element from the array and do the same
if you provide more data it would be much more easier, because the easiest solution is to find many patterns and plan only for them

ConceptNet RelatedTo Tuning

I'm using ConceptNet http://conceptnet.io to try to get related keywords using both their relatedto and edge/query endpoints. The data is awesome, however I've encountered some behaviour I can't figure out.
If you query "relatedto" for the keyword "person" with a limit of 20 on the main site you get:
http://conceptnet.io/c/en/person?rel=/r/RelatedTo&limit=20
Or this list of words:
doll
character
statue
person
servant
body
farmer
child
man
baby
guard
name
doctor
captain
people
neighbour
boy
Pretty awesome right? That's super topical and useful.
On the other hand if you query the API with what appears to be the same query formatted for the API:
http://api.conceptnet.io/related/c/en/person?filter=/c/en&limit=20
Shortened for clarity (see the link above for the full response):
{
"#id": "/c/en/person",
"related": [
{
"#id": "/c/en/person",
"weight": 1.0
},
{
"#id": "/c/en/sean_connery",
"weight": 0.963
},
{
"#id": "/c/en/steve_ballmer",
"weight": 0.962
},
{
"#id": "/c/en/norman_jewison",
"weight": 0.962
},
{
"#id": "/c/en/aretha_franklin",
"weight": 0.962
}
]
}
Huh. What happened there? That's a lot less useful. We got just names and not very related terms.
So my question is: How do I get a similar list?
Are they using some complex edge analysis (using a standard, not relatedto query) to get the relatedterms on the website?
OR
Am I missing something I can't figure out?
Any help much appreciated.
Thanks
To query for existing edges labeled with /r/RelatedTo that contain the node /c/en/person, you should query: http://api.conceptnet.io/query?node=/c/en/person&rel=/r/RelatedTo
The results of that query match the Web site.
The /related endpoint is different, and is only present in the API. It applies some machine learning to predict nodes that are related, whether or not the edge connecting them is already present in ConceptNet. It's better for more specific concepts than "person". Try "teacher" for example: http://api.conceptnet.io/related/c/en/teacher?filter=/c/en&limit=20

InvalidSlotTypeLiteral: Slot type "AMAZON.LITERAL" for slot "Text" in intent "RawText" is not valid

AMAZON.LITERAL is deprecated as of October 22, 2018. Older skills built with AMAZON.LITERAL.
What is the alternative to AMAZON.LITERAL, I want each and every word spoken by user from Alexa device in my endpoint API.
I have created custom slots, but my endpoint is not called everytime.
Anyone have solution to this?
You will not get the entire user input through any inbuilt slots or intents. The closest one to your requirement that I can think of is AMAZON.SearchQuery.
AMAZON.SearchQuery
AMAZON.SearchQuery is a phrase-type slot that lets you capture less-predictable input that makes up the search query. You can use phrase slots when you cannot predict all possible values the user might say, or when there may not be an identifiable pattern that can be captured by a custom slot. The intended use of this slot is to capture short messages, comments, search queries, and other short free-form text, not the entire user spoken utterance.
Ex:
{
"intents": [
{
"name": "SearchIntent",
"slots": [
{
"name": "Query",
"type": "AMAZON.SearchQuery"
},
{
"name": "CityList",
"type": "AMAZON.US_CITY"
}
],
"samples": [
"search for {Query} near me",
"find out {Query}",
"search for {Query}",
"give me details about {CityList}"
]
}
]
}
You cannot add sample intent utterances consisting of only phrase type slots.
That means, you cannot give something like this:
{
"name": "QueryIntent",
"slots": [
{
"name": "query",
"type": "AMAZON.SearchQuery"
}
],
"samples": [
"{query}" // utterance with only phrase-type slot
]
}
More on AMAZON.SearchQuery here
Alexa will always will fire a POST request to your skill's endpoint with a payload whenever there is a user interaction.

What is the meaning here list in array calling

Below I have environment file and recipe can you explain I am not getting what is the list here.
{
"json_class": "Chef::Environment",
"description": "prod environment",
"default_attributes": {
},
"chef_type": "environment",
"override_attributes": {
"user": {
"mapr": {
"id": "application",
"group": "application",
},
"local" : {
"id": "chef",
"group": "chef"
},
"ldap" : {
"id": "ldap",
"sudo": true,
},
}
"name": "prod"
}
Below is the recipe what is the list here i did not get
node['user_create'].each do |list, user|
group user['group'] do
group_name user['group']
gid user['gid']
action [:create]
ignore_failure true
end
user user do
username user['id']
uid user['uid']
group user['gid']
home user['home']
manage_home true
end
if list !='ldap'
How list is passing here in if condition
You are not actually passing in any attributes via the environment, which you can see because the values of default_attributes and override_attributes are both just empty hashes { }. The data you've included there is just ignored by Chef as noise. In the future I recommend you use the Ruby DSL for environment files as it has more error checking for things like this (though not perfect error checking).
As an aside, you've been asking a lot of questions on here and seem to be struggling with Chef. Please consider joining the Chef community Slack team and asking there instead as it's a full chat system and thus the community could offer real-time help rather than here random blurbs.

Resources