I'm making a list of the videos of my channel, and want to use the search endpoint of the API : https://developers.google.com/youtube/v3/docs/search/list
Ther eis a "q" parameter to send the query. What completely bugs me is that no wildcard is referenced in the documentation, and when using * it doesn't do anything. For example, in order to find any video containing "television" in the title, the full word has to be input ! Sending "tel" won't work, nor sending "televisio".
Did I miss something ? Is there a way around this ?
Thanks !
YouTube searching works along the same paradigm as Google searching, which is quite a bit different than the character-wildcard keyword approach. It's semantic probabilistic searching, looking for relevance based on the terms you give it, so while the * does represent a wildcard, it represents a whole word. For example, you can search for "a * saved" and it will return to you the videos which score the highest relevance score where any word could be substituted in place of your wildcard.
You can also use other punctuation based search operators ... the + sign, - sign, quotation marks, etc. Just make sure they're all URL encoded before you send the query in.
Related
TL;DR What are the rules used by twitter to determine whether a tweet matches a certain query, and how can those be replicated?
Hello,
I am using the Twitter API (both v1 and v2, long story) for the development of an academic tool for research purposes.
I need to be able to know if a given string would match a twitter query. A simple regex keyword match wouldn't work as it is my understanding that they are tokenized so that looking for Pied Piper can return #PiedPiper, #piedpiper_official, Pied Piper, #pied piper, etc.
I think the problem requires a deeper understanding of how the search works "under the hood" (not how to use the API, but rather understanding the matching process and rules used by twitter to determine which tweets are returned by the query). After days of research, I have found nothing.
Please let me know if you know any details. As small as they might seem, they can help a lot.
Concatenate tokens, lowercase, then match.
#! /usr/bin/env python3
import re ## docs.python.org/3/howto/regex.html
## only grab AlphaNumeric chars, skip # # and whitespace
tokens = re .findall( '\w+', 'Pied Piper' )
print( tokens )
['Pied', 'Piper']
## concatenate & lowercase
lowercase = '' .join( tokens ) .lower()
## www.w3schools.com/python/ref_string_join.asp
print( lowercase )
piedpiper
I'm using Google Cloud Speech API with IBM Voice Gateway in order to interact with a VoiceBot through a phone.
If I say an identifier contening letters and numbers through the phone, the Google Cloud Speech converts it into string with spaces. For example, if I say "A1B2C3", it will convert it into the following string "a 1 b 2 c 3".
Do you know if there is way to avoid these useless spaces ?
Thanks for your help!
Lucas
I don't see any way in which you can eliminate spaces from the API response. What you could do is experiment with the available features, as this is probably your best chance to get a recognition more similar to what you are looking for.
For example: you can provide some sample hint phrases echoing your use case, indicate that the audio is a phone call, or use an enhanced model (although for the latter to be available you need to first opt in for data logging).
Honestly though, for your case, it might be better if you post process the returned string (e.g. with a simple "a 1 b 2 c 3".replace(' ','') ).
I am developing an application in iOS where I need to add a functionality to switch the application language in Chinese/English.
I am using Baidu API to achieve this. I am able to translate single world or complete one sentence. But suppose my has multiple text which I need to place at diff location then either I have to hit the API multiple times or by wrapping all into one API.
I have followed their documentation but nothing seems work.
As per their documentation.....
1. How do I translate multiple words or more text in a request?
You can use the newline (in the majority of the programming language for the escape symbol \ n) in the sent field q to separate the multiple words or pieces of text to be translated so that you can get multiple words or multiple text independent translations The result. Note that before sending the request to the q field do URL encode!
And I am trying to get the result for this....
appid = 2015063000000001 + q = apple + salt = 1435660288 + key = 12345678
Let me give an example: Suppose I need to convert two different word. “apple” and “mango”
2015063000000001+apple\ nmango+1435660288+7_8ogRLnl7PO52O0UYd2
2015063000000001apple\n mango143566028812345678 (Get the MD5 = c0610b314af72e42a4a5b9e62757faf7)
http://api.fanyi.baidu.com/api/trans/vip/translate?q=apple\nmango&from=en&to=zh&appid=2015063000000001&salt=1435660288&sign=c0610b314af72e42a4a5b9e62757faf7
When I am hitting above url on chrome then getting this result.
Result : {"error_code":"54001","error_msg":"Invalid Sign”}
Now I got the answer for my question.
In URL replace "\n" with URL encode "%0A".
Also generate MD5 via the code not from online.
I have a file that contain twitter post and I am trying to identify the structure of the twitter post per line, like get the noun ,verb and stuff, using opennlp.
it work perfectly until it reach line that contain hashtag and link only
example :
#birthday www.mybirthday/test/mypi.com
and give error com.cybozu.labs.langdetect.LangDetectException: no features in text
when I write a sentence next to the line it just work. any idea how to handle it?? there are more then thousand line that almost like the example.
To use the POS tagger, you need to pass tokens, (in laymen terms say individual words). The link contains multiple words separated by a slash /. The link in itself is not associated with any Part Of Speech. See here the list of tags and how they are assigned to a word. If you want it to identify your link, and give a separate tag to it, say LN either give your own training data, here you will know how to create the training dataor separate the words in the link as separate token (you can separate a link by slash/, question mark?, equal to sign = or ampersand (&)) to get the underlying words and then use the POSTagger to get Part Of Speech (similar case for the hash tag.) For tokenization also, you can use opennlp tokenizer and for your special case, train it. Go through the documentation, it will help you a lot.
I'm using the Twitter streaming API. It works wonderfully for single words, but seemingly cannot filter by an exact bigram (two word string).
I'm testing this by searching for common words, that are commonly in combination:
e.g. "feel good"
This is the URL: (will require OAuth login):
https://stream.twitter.com/1.1/statuses/filter.json?track=keywords_go_here
Things that don't work:
track=feel%20good ==> still produces: "text":"Feels so good outside!..."
track=%27feel%20good%27 ==> produces nothing
track=feel%20good, ==> still produces "good that my friend has an ED too because I can feel..."
Any ideas on getting this to work?
edit: someone sort-of answered this in early 2010: Twitter Streaming API - tracking exact multiple keywords in exact order , but are there any updates on this issue?
It seems like you can do that search according to the api: https://dev.twitter.com/docs/using-search
"happy hour" containing the exact phrase "happy hour"
Just need to put your phrase in quotation
I am sorry, but the answer is
Exact matching of phrases (equivalent to quoted phrases in most search engines) is not supported.
Furthermore,
Punctuation and special characters will be considered part of the term they are adjacent to.
So if you track "feel good", you will get messages such as
He said, "feel it", and I replied, "I am good".
If you want exact matches, then you have two options:
A) track both terms and then discard all tweets that don't have exact matches, or
B) get a paid subscription to the Twitter firehose with Gnip or DataSift. Twitter makes a living out of things like this, so I don't think it's ever gonna be available on the Streaming API.