alchemyapialchemy

AlchemyNews API multiple relevance scores not working properly


It doesn’t seem like the relevance score parameters are working when more than 1 used. In other words...I essentially would like to get advertising articles where the concept and keyword is advertising with both relevance scores =>0.8. In addition, use a taxonomy with advertising with a relevance score =>0.8. Here is the query, I separated the parameters to make it easy to read.

https://access.alchemyapi.com/calls/data/GetNews?apikey=APIKEY&start=now-7d&end=now&outputMode=json&return=enriched.url.url,enriched.url.title,enriched.url.taxonomy,enriched.url.keywords,enriched.url.concepts
&q.enriched.url.concepts.concept.text=advertising
&q.enriched.url.concepts.concept.relevance=>0.8
&q.enriched.url.taxonomy.taxonomy_.label=business and industrial/advertising and marketing/advertising
&q.enriched.url.taxonomy.taxonomy_.score=>0.8
&q.enriched.url.keywords.keyword.text=advertising
&q.enriched.url.keywords.keyword.relevance=>0.8
&q.enriched.url.title=O-[jobs^job]
&q.enriched.url.title=O-[careers^career]
&q.enriched.url.title=O-[cv^resume]
&dedup=1
&rank=high^medium

I am getting article results that has “enriched.url.concepts.concept.text=advertising” with a relevance score lower than “0.8” and/or “enriched.url.taxonomy.taxonomy_.label=business and industrial/advertising and marketing/advertising” with a relevance score lower than “0.8”. For example, the article “4 Tips for Maximizing the User’s Advertising Experience” in the results is excellent because it meets all 3 of the parameters that require a relevance score (eg has a relevance score >=0.8).

"concepts": [
                                    "relevance": 0.974825978,
                                    "text": "Advertising"
                                },
"keywords": [
                                {
                                    "knowledgeGraph": {
                                        "typeHierarchy": "/services/mobile advertising"
                                    },
                                    "relevance": 0.910649002,
                                    "sentiment": {
                                        "mixed": 0,
                                        "score": 0,
                                        "type": "neutral"
                                    },
                                    "text": "mobile advertising"
                                }
"taxonomy": [
                                {
                                    "confident": "",
                                    "label": "/business and industrial/advertising and marketing/advertising",
                                    "score": 0.991141975
                                }

However, this is an example of what most of the results look like, where it meets none or just one of the relevance scores:

"concepts": [{
                                    "relevance": 0.447964013,
                                    "text": "Advertising"
                                }
"keywords": [{
                                    "knowledgeGraph": {
                                        "typeHierarchy": "/people/users/third parties/advertisers"
                                    },
                                    "relevance": 0.623048007,
                                    "sentiment": {
                                        "mixed": 1,
                                        "score": -0.291121989,
                                        "type": "negative"
                                    },
                                    "text": "advertisers"
                                }
"taxonomy": [
                                 {
                                    "confident": "no",
                                    "label": "/business and industrial/advertising and marketing/advertising",
                                    "score": 0.345863998
                                }

I ultimately would like the query to only return results like the first example where it meets all 3 criteria (e.g. with relevance scores > = 0.8). Could someone please look into this? Is something wrong with the query? Thanks!


Solution

  • Dennis: Looks like you encountered a bug in processing of the URL parameters. The solution requires compactly reformatting your parameters, but that's the preferred format for complicated URLs anyway.

    E.g. instead of sending your parameters like this:

    q.enriched.url.concepts.concept.text=Advertising
    q.enriched.url.concepts.concept.relevance=>0.80
    q.enriched.url.taxonomy.taxonomy_.score=>0.8
    q.enriched.url.taxonomy.taxonomy_.label=business and industrial/advertising and marketing/advertising
    q.enriched.url.keywords.keyword.text=Advertising
    q.enriched.url.keywords.keyword.relevance=>0.80
    

    You would instead group them:

    q.enriched.url.concepts.concept=|text=Advertising,relevance=>0.80|
    q.enriched.url.taxonomy.taxonomy_=|score=>0.8,label=business and industrial/advertising and marketing/advertising|
    q.enriched.url.keywords.keyword=|text=Advertising,relevance=>0.80|
    

    So this final URL works for me:

    https://access.alchemyapi.com/calls/data/GetNews?q.enriched.url.concepts.concept=|text=Advertising,relevance=>0.80|&q.enriched.url.keywords.keyword=|text=advertising,relevance=>=.8|&q.enriched.url.taxonomy.taxonomy_=|label=business and industrial/advertising and marketing/advertising,score=>=.8|&return=enriched.url.url,enriched.url.title,enriched.url.concepts,enriched.url.taxonomy.taxonomy_,enriched.url.keywords&apikey=APIKEY&start=now-7d&end=now&outputMode=json&q.enriched.url.title=O-[jobs^job]&q.enriched.url.title=O-[careers^career]&q.enriched.url.title=O-[cv^resume]&dedup=1&rank=high^medium