how to get telephone number from google by submitting company name and address? - delphi

A customer asked me a simple app that retrieves the telephone number given the full address of a company.
So imagine a simple edit box where I type
Dummy Company ltd - 143, High Road, 519243 DummyCity, DU - DummyCountry
and I ask "google" or something else and I get the telephone number as answer.
Of course I need to do this for many customers at once, but if I can do it for 1 it is easy to extend.
Did anyone already implemented something like this?

Why dont you try to contact the "yellow pages" in your region and ask them, guess they provide such an API, take a look at the canadian one for example

Related

exclude certain text from keyword analysis in google sheets

I'm trying to do a little bit of analysis on the topics of emails I receive. I have the emails in a Google-sheet in the format below. I'm trying to count how often 'privacy' or 'confidentiality' are mentioned. My challenge is that pretty much every email signature mentions one of those words, so when i use SEARCH every cell returns TRUE.
Most email signatures start with similar phrases, so I tried deleting anything after those phrases with this formula:
=ArrayFormula(TRIM(LEFT(B1:B,MIN(IFERROR(FIND({" This email and any","IMPORTANT NOTICE", " Important notice","The information in this email"," The contents of this message"," Information in this email including"," This electronic mail message"," this message and any attachments"," This message is intended for the addressee only"," This email is CONFIDENTIAL"},B1:B),LEN(L2))))))
Column B is the column with the email body text in.
However that seems to be deleting text that follows words that aren't in my search (deleting everything after 'not' instead of 'IMPORTANT NOTICE' for instance).
Could anyone advise on either:
what's wrong with my above search
an alternate way of searching for 'privacy' and 'confidentiality' without including text from email signatures.
Example table:
|email title|email body|
|-----------|----------|
|Do you want to buy my stuff| Hi there, I'd like to know if you'd like to buy this thing I want to sell you. IMPORTANT: this email is private|
|two-for-the-price-of-one| I've a great offer for you! This email and attachments are private & confidential|
|Last chance to buy stuff!| Can we have a private call about whether you want to buy my stuff yet?|
In the example above I want to count row 3, but not rows 1 & 2, as the 'private' and 'confidential' mentions in 1 & 2 are in the signature.
Thanks!
I think I understand the error that you've described is occuring with your formula. Once the formula finds one of the values you are using to try to identify an email signature, such as " Important notice", and returns the location of that text, let's say position 96, it then uses 96 for all of the cells, like this: LEFT(B1:B,96). So you might not be able to do the compound arrayformula of an arrayformula that you are trying.
Using the formula like this, in B2, and dragging it down, should work though:
=ArrayFormula(TRIM(LEFT(B2,MIN(IFERROR(
FIND({" This email and any","IMPORTANT NOTICE", " Important notice","The information in this email"," The contents of this message"," Information in this email including"," This electronic mail message"," this message and any attachments"," This message is intended for the addressee only"," This email is CONFIDENTIAL"},B2),
LEN(L2))))))
Note: I'm not sure what value is in your L2.
But for the overall approach, it really depends on how well your terms to identify email signatures work, so as to exclude them from your final full text searches.

Replace emails, phones and addresses in string (like AirBnB does it)?

I need to implement the same functionality in my Rails app as AirBnB has in their iOS app. When you write to a person on AirBnB, your phone, email and address will be blocked, so you get something that looks like this:
Input:
Email addresses likeemail#example.com or email AT example DOT com should be replaced. Phone numbers like 347 323 4567 or tree four seven, three two three four five six seven should also be replace.
Output:
Email addresses like (email hidden) or (email hidden) should be replaced. Phone numbers like (phone hidden) or (phone hidden) should also be replace.
This is to ensure that people can't make "offline" deals. I've looked everywhere, but it doesn't seem like there is any gems our there that have done something similar.
This seems like one of those things with a thousand edge cases, so would rather not implement it myself. Does anyone know of any gems already out there?
The following (taken from this question) will have some false negatives (using regular expressions for email addresses always will) but will catch the majority of emails in a string
'email addresses like me#example.com'.gsub(
/^\w+([-+.']\w+)*#\w+([-.]\w+)*\.\w+([-.]\w+)*$/, '(email hidden)')

Address field validation for iOS / Mac

I want to create an "Add Address" view, a very basic "Street, City, Zip, Country" type of page: multiple text fields inside a table view. This is simple if you only ever added U.S addresses, but I'm not sure about how to do this the right way though, handling all international use-cases as well. Essentially:
1. How do you pick the right field label for each country? For e.g. for US / Australian addresses, the field should be called "State"; for UK, it's called "County", in some places it's called "Province". How do you know what the label should say (short of hard-coding logic myself for each country)?
2. How do you validate the values for those field? UK postal codes have a certain format, whereas in the US it's a 5-digit ZIP code. Also, in the US, there is a list of states that the user can select. How do you get that list?
I've looked into NSLocale, and can't find any way to do this. Surely there must be a good and easy way to do this?
I dug around and in the end the best thing I found was a guide on "The good international address field form", but it'll still be hard to validate it. I don't think it's done.
http://www.uxmatters.com/mt/archives/2008/06/international-address-fields-in-web-forms.php
One method could be to reverse lookup the address through mapkit.
You can try to simplify the UI by adding just one text field and ask user to enter his address in an arbitrary way, and then use CLGeocoder class to convert the string to instance of CLPlacemark, which is a convenient container for such information as country, postal code, etc.

How to do a city/state/country code lookup based on zip/country input by the user?

Would there be a way to do a city/state/country code lookup based on zip/country input by the user? My site will be international, hence the reason for asking the user to input their country.
I'm thinking the user inputs the zip/post-code and country, which gets saved to the database and then the Google geocode API will convert this to city, state and country and print the output to their user profile. For example:
User input:
Zip - 92646
Country - USA
Output:
Huntington Beach, CA, USA
I could just let the users input their city, state and country, but in the future I want to do some geocoding. So it makes sense to set it up now rather than migrate the database at a later stage. Or do you think I'm doing the wrong thing here? I have a site built in Rails. Thanks in advance.
** Comment: Looks like the demonstration on the RubyCoder Gem allows you to input the zip and country to print the City/State/Country/Zip, which is exactly what I'm after. Thoughts on Geocoder versus Google goecoder API?
I would advise to use the geocoder gem and allow the user to enter their address on one field. It is easier for the user to enter only one field in it a convenient format. And keep it string as a full address. Then give this address to geocoder (in general geocoder will do it automatically), and from there take the coordinates, city, state, etc.
If the user enters a bad address, he simply clarify it. This is just my opinion, not the rule.

User input parsing - city / state / zipcode / country

I'm looking for advice on parsing input from a user in multiple combinations of City / State / Zip Code / Country.
A common example would be what Google maps does.
Some examples of input would be:
"City, State, Country"
"City, Country"
"City, Zip Code, Country"
"City, State, Zip Code"
"Zip Code"
What would be an efficient and correct way to parse this input from a user?
If you are aware of any example implementations please share :)
The first step would be to break up the text into individual tokens using spaces or commas as the delimiting characters. For scalability, you can then hand each token to a thread or server (if using a Map-Reducer like architecture) to figure out what each token is. For instance,
If we have numbers in the pattern, then it's probably a zip code.
Is the item in the list of known states?
Countries are also fairly easy to handle like states, there's a limited number.
What order are the tokens in compared to the common ways of writing an address? Most input will probably follow the local post office custom for address formats.
Once you have the individual token results, you can glue the parts back together to get a full address. In the cases where there are questions, you can prompt the user what they really meant (like Google maps) and add that information to a learned list.
The easiest method to add that support to an applications, assuming you're not trying to build a map system, is to query Google or Yahoo and ask them to parse the date for you.
I am myself very fascinated with how Google handles that. I do not remember seeing anything similar anywhere else.
I believe, you try to separate an input string in words trying various delimeters - space, comma, semicolon etc. Then you have several combinations. For each combination, you take each words and match it against country, city, town, postal code database. Then you define some metric on how to evaluate the group match result for each combination. Here should also be cross rules, like if the postal code does not match well, but country, city, town match well and in combination refer to a valid address then the metric yields a high mark.
It is sure difficult and not an evening code exercise. It also requires strong computational resources - a shared hosting would probably crack under just 10 requests, but a data center could serve it well.
Not sure if there is an example implementation. Many geographical services are offered on paid basis. Something that sophisticated as GoogleMaps would likely cost a fortune.
Correct me if I'm wrong.
I found a simple PHP implementation
http://www.eotz.com/2008/07/parsing-location-string-php/
Yahoo seems to have a webservice that offers the functionality (sort of)
http://developer.yahoo.com/geo/placemaker/
Openstreetmap seems to offer the same search functionality on its homepage
http://www.openstreetmap.org/
Assuming you're only dealing with those four fields (City Zip State Country), there are finite values for all fields except for City, and even that I guess if you have a big city list is also finite. So just split each field by comma then check against each field list.
Assuming we're talking US addresses-
Zip is most obvious, so check for
that first.
State has 50x2 options
(California or CA), check that next
Country has ~190x2 options, depending
on how encompassing you want to be
(US, United States, USA).
Whatever is left over is probably your City.
As far as efficiency goes, it might make sense to check a handful of 'standard' formats first, like Dan suggests.

Resources