How to find the language of a Tweet using Tweepy? - twitter

I gave a stream of Tweets that I filter based on certain criteria. I do not wish to use the language criteria during streaming itself. Rather, I wish to know the language of such filtered tweets.
I'm using Tweepy for streaming. Kindly suggest to me a solution for this.

Status/Tweet objects have a lang attribute. Note though, that it is nullable, meaning it could be None:
When present, indicates a BCP 47 language identifier corresponding to the machine-detected language of the Tweet text, or und if no language could be detected.

Related

Convert ID from speech to text without spaces

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(' ','') ).

Extract Salesforce record Id from URL with Zapier Push

I need a way to extract the Salesforce record ID from a URL using Zapier Push. How can I find the first 3 characters in a string that match the start of the Id like 006 and then return a set number of characters after that?
The url is formatted as such:
https://useindio.lightning.force.com/lightning/r/Opportunity/006f400000AiVufAAF/view
David here, from the Zapier Platform team. Good question!
Whenever you want to extract data from a string and you know the exact format the string will be in, Regular Expressions are the answer.
Assuming you want to grab anything after 006 (and you know it'll always be there), you could use the regex 006(\w{15}) (more info), which will find the 15 characters after that. If you know the surrounding url will always be the same, you could easily grab the whole ID by anchoring via Opportunity and view: \/Opportunity\/(.*)\/view (more info).
Either way, there's info about setting up a formatter zap here, or you could do it in code (JS Example, Python Example).
​Let me know if you've got any other questions!

Youtube API v3 : no wildcard in search?

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.

Youtube API - relevance_lang_languageCode vs lr parameter

i think that the relevance_lang_languageCode doesn't work or i didn't understand How... ...with language restriction it finds only video for a specific language (and i agree) but with orderby=relevance_lang_languageCode it doesn't insert (at least) for first the videos from that specific language...
example:
http://gdata.youtube.com/feeds/api/videos?vq=MSI%20GTX%20680%20Twin&orderby=relevance_lang_de
it seems to work...but
http://gdata.youtube.com/feeds/api/videos?vq=MSI%20GTX%20680%20Twin&orderby=relevance_lang_it
even if
http://gdata.youtube.com/feeds/api/videos?vq=MSI%20GTX%20680%20Twin&lr=it
finds video from italian language...
do you know why?
If you want to retrieve videos that are in Italian, use lr=it. You can use that in conjunction with orderby=relevance_lang_it if you want to retrieve results that are ordered by relevance to Italian speakers and are all in Italian. It's not an either/or thing with those two parameters.
http://gdata.youtube.com/feeds/api/videos?q=MSI%20GTX%20680%20Twin&orderby=relevance_lang_it&v=2&lr=it
The documentation for orderby= explains that even when you specify relevance_lang_LC, the results are not guaranteed to be in that language.
https://developers.google.com/youtube/2.0/developers_guide_protocol_api_query_parameters#orderbysp

localising postal / physical address display from database fields

Can anyone point me to a list of international postal / residential / delivery address format templates that use some kind of parseable standard vocabulary for address parts?
The ideal list contains a country code then a format using replaceable tokens so I can substitute database address fields into a template to produce something printable in the local format.
for example
NZ | [first_name] [family_name]\n[company_name]\n[street_address]\n[city] [post_code]\n[country]
AU | [first_name] [family_name]\n[company_name]\n[street_address]\n[city]\n[state] [post_code]\n[country]
US | etc
UK | etc
Background: I used to have a simple freetext field to accept addresses. Moving to support vCard download, which requires addresses to be broken down into specific fields. Thats all fine: we can do the migration. I'm looking for a way to display the fields in the "correct" order for each country. thanks for your help!
This MSDN page has the information in the format you need and seems accurate, but covers only 33 countries. Maybe they are enough.
The Universal Postal Union offers all the information you need for a lot of countries here. This is top quality information; however, it is split across as many PDF documents as there are countries and is not in the format you need.
This page provides the information in a slightly more accessible form. As far as I can judge, it is accurate (and contains a lot of valuable info), but I can't speak to its quality nor its currentness.
Google have a JSON-based API that they use for their Android address input field library that contains this kind of formatting information.
The field you'd be interested in is fmt. There doesn't seem to be any formal documentation on the format they use, but a proposal to include this information as part of the Unicode CLDR has matching fields (scroll down to "Detailed Breakdown of elements"); there are also some clues in Google's libaddressinput source code.

Resources