Gnewsclient package doubt

client.getnews() is returning an empty list.

hey @Mohit2000 ,
kindly check that your agent in dialogflow console is properly trained with entities else it will return a empty list always.

Kindly check that once.
Thank You :slightly_smiling_face:.

When I am using gnewsclient independently then client.getnews() is giving an empty list. My dialogflow agent is trained.

did you set the parameters , based on which we need to search news ?

client = gnewsclient.NewsClient()
client.get_config()
{‘location’: ‘United States’, ‘language’: ‘english’, ‘topic’: ‘Top Stories’}

client.location=“india”
client.topic=“top stories”
client.language=“english”
client.get_config()
{‘location’: ‘india’, ‘language’: ‘english’, ‘topic’: ‘top stories’}

client.get_news()
[]

See,I am getting an empty array and not the list of news

can you please confirm from dialogflow agent that ,
the topic is top stories , everything in small letters.

case of each letter also matters, so just once check that.

Do we have to give default values for client parameters(lang,topic,loc) in the fetch_news function in utils.py.

no not default.
Its actually depends on which you have trained your model on.
So, the way you train will effect your results in the same way.

If the user on telegram has written entertainment news, in that case client.language=""
client.location="" and client.topic=“entertainment”. So in that case, how we gonna get the news from client.get_news() ? For such case, I am asking do we need to specify some default value for these parameters?

yeah , in that case you do need to provide some default values.
Just check once , i guess dialogflow has functioning already.

I wrote tech news only, news bot is giving news in English.

have you added this in your identities to understand that tech is to be related to technology ?
If not , then do so.
and as you see you got news in English , then you can say that , the default language was english.

I am getting news for all the topics except the top stories one. Why it is so?

such problems are only related to your training.
You just need to provide more such samples while training, so that it can understand it more better .

I have written the same phrase in training phrases of dialog flow. But when I am sending the same phrase to the news bot.

yeah thats only problem.

I tried too personally on my code, while although using the same things as shown on the video , still it didn’t worked.
But i did change and added a more lot of things, and it worked.
So , i just suggest you to do the same and work more better.

client.location=“india”
client.language=“hindi”
client.topic=“top stories”
when I wrote the above code directly on the jupyter-notebook, it is giving an empty list. But for all the other topics, it is giving the news. So, I think the problem is with the gnewsclient package

gnewsclient is just a package that sends your input to the API and fetches results , it doesn’t do anything on its own.
So , again the same thing.
If your model knows, how to respond to particular input then it will give some result else it will send nothing.

But I think I have done all the things correctly. Even dilaogflow agent is able to understand what is the topic in given sentence. Then why model is giving an empty list for the topic top stories?

yeah ofcourse , you might be right .
But i am just telling about the functioning of gnewsclient , that it doesn’t any such post processing on the data to make it work.
it just sends the input you give.
So ,your output fully depends upon the way your model is trained.