AlchemyNews API多个相关性分数无法正常工作

时间:2016-04-14 19:13:42

标签: alchemyapi alchemy

当使用超过1时,相关性得分参数似乎不起作用。换句话说......我基本上希望获得广告文章,其中概念和关键字是广告,相关性得分=> 0.8。此外,使用具有相关性得分=> 0.8的广告的分类法。这是查询,我将参数分开以便于阅读。

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

我得到的文章结果有“enriched.url.concepts.concept.text = advertising”,相关性得分低于“0.8”和/或“enriched.url.taxonomy.taxonomy_.label = business and industrial /广告和营销/广告“相关性得分低于”0.8“。例如,结果中的文章“最大化用户广告体验的4个提示”非常好,因为它符合所有需要相关性得分的3个参数(例如,相关性得分> = 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
                                }

然而,这是大多数结果的例子,它不符合相关性或只有一个相关性得分:

"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
                                }

我最终希望查询仅返回结果,如第一个例子,它满足所有3个标准(例如,相关性得分> = 0.8)。有人可以看一下吗?查询有问题吗?谢谢!

1 个答案:

答案 0 :(得分:0)

丹尼斯: 看起来您在处理URL参数时遇到了错误。该解决方案需要紧凑地重新格式化您的参数,但这仍然是复杂URL的首选格式。

<强> E.g。而不是像这样发送您的参数:

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

您可以将它们分组:

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|

所以这个最终的网址适用于我:

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