I have data in Backus-Naur form. In the below example a string can be either an email address if it ends there, or a business name if a new line comes after it. In my code I created a graph, dumped the graph as bytecode then wrote a DFA state machine (deterministic finite automaton) to parse everything.
The problem is Address, it's recursive and slow. My state machine will see Addr: My String and reduces/pop the state which is good so far. Now is the problem. Address2 can be 1 of 2 things. To handle the first the state machine pushes it's current location and jumps to the part that checks '-' (for the line Address2 - Address3), if it's not there (which is most of the time) it pops the state to handle the other case, pops, then once again pushes and pops to handle Address being two different state.
In my real bnf address goes about 30 deep and instead of 2 cases it can handle up to 15. In a profiler I see most of the time is constantly pushing/popping the state and reading the bytecodes each and every time (ie the part that says compare with + or -)
I'm not sure what my code or data is called and I have no idea what to look up or how to optimize it.
Start:
Name NL Address
Name NL email
email
Name:
PersonName
BusinssName
PersonName:
ALPHABET ALPHABET //first last
ALPHABET ALPHABET ALPHABET //first middle last
BusinssName:
STRING
email:
STRING
Address:
Address + Address2
Address2
Address2:
Address2 - Address3
Address3
Address3:
"Addr:" STRING
Related
I am using a Google Places API to return ratings for an entered property. When I enter the property name as the search term, a rating is returned, but if I attempt to return a rating by using an address (which is supported by the text input) I do not receive a response. I have tried searching an address through the API, returning a Place ID and then using the Place ID to return a rating, but that does not work.
This API returns a rating: https://maps.googleapis.com/maps/api/place/findplacefromtext/json?input=The+Shops+At+Chestnut+Hill&inputtype=textquery&fields=rating&key=[MY API_KEY]
This is the same property, but searched by address, which does not: https://maps.googleapis.com/maps/api/place/findplacefromtext/json?input=199+Boylston+St+Chestnut+Hill+MA&inputtype=textquery&fields=rating&key=[MY API_KEY]
Is there something different with the formatting of address inputs I am not doing correctly?
The places API has separate ids for the address/building and the establishment in it. The address/building won't have the rating, the place/establishment will.
From the PlaceId Finder
The Shops at Chestnut Hill
Place ID: ChIJkcWRbZF444kRJUJjXdUFIOw
199 Boylston St
Place ID: ChIJ4TgqFZF444kR2XHKhTgsiNs
(although I do see an entry in the dropdown for the "place" when I enter the address)
The Places API nearbySeach only returns places, not address place ids. The geocoder returns the place_id of the address. But the nearbySearch takes a set of coordinates, not an address, so to get those results from an address requires two calls, one to geocode the address, one to get the nearbySearch results from that location.
Note that there are multiple results at the location of that address (4 exactly at the location returned from geocoding "199 Boylston St Chestnut Hill MA", and 15 other places that are nearby and in the footprint of "The Shops at Chestnut Hill"), more if you use pagination to get more than 20 results.
I am creating a dialogue to "make a complaint".
The data to use in this dialog are:
Contract number: it can consist of 10 numbers or numbers and letters (Type : pattern)
Company (Type : entity)
Name: it can be composed of ([A-Za-z àâæçéèêëîïôœùûüÿÀÂÆÇnÉÈÊËÎÏÔŒÙÛÜŸ'- ", ]){1,} (Type : pattern)
First name: it can be composed of ([A-Za-z àâæçéèêëîïôœùûüÿÀÂÆÇnÉÈÊËÎÏÔŒÙÛÜŸ'- ", ]){1,} (Type : pattern)
Object of complaint : paragraph which can contain letters, numbers, characters, spaces, ... (Type : pattern)
After the collection of these data, a question will arise to the customer:
your contract number is $num_contrat, your surname is: $surname your first name is: $first_name your claim is: $obj_reclamation. Do you confirm these data?
If yes, the claim will be recorded in the database. If not, the question that will be asked is: what data do you want to edit ? ...
Until now, my bot detects only the $company because it exists in the company entity and it does not detect $num_contrat, $surname, $first_name and $obj_reclamation.
I would recommend to test your regular expressions with a testing tool. I ran your regexp at: https://regexr.com
It reported the error:
Range values reversed. Start char code is greater than end char code.
Which relates to -.
So your correct regular expression to fix this should be.
([A-Za-z àâæçéèêëîïôœùûüÿÀÂÆÇnÉÈÊËÎÏÔŒÙÛÜŸ'\- ", ]){1,}
But you still have an issue. This is going to match the first full string that is entered. If the person is using slots, you are only going to detect the first word.
You have a few options to resolve this.
1. Use the #sys-name system entity. That will get you a persons name.
2. You can structure your request to ask for their explicit name.
3. You can create a mini form to force them to fill with structured content. Requires UI work.
4. You can create a cloud function to pass it to NLU which you can have return the persons name and company names, etc. I have an example here.
When using the Nokia Here Geocoding Service the State parameter is ignored when searching by searchText: 315 NE 14th Street, State: FL and Country: US.
The only result returned is a location in Louisiana. Adding the State to the end of the searchText doesn't work either.
Google and MapQuest properly return the result in Florida. The client does not want to include a city but rather an address, state and country.
I know that the Nokia Here algorithm does not filter down a closely as Google and MapQuest but expected that the inclusion of the State parameter would force the result search.
You can try setting a search area, so you can further narrow down the results. The following Android example will return one result in Homestead, Florida City:
String query = "315 NE 14th Street Florida US";
GeocodeRequest geocodeRequest = new GeocodeRequest(query);
GeoCoordinate areaCenterCoordinate = new GeoCoordinate(27.82353, -81.760254);
geocodeRequest.setSearchArea(areaCenterCoordinate , 15000);
According to documentation GeocodeRequest processes text string queries, so I believe you can omit state or country parameters and add state or country as part of the search term. Please note that multiple results can be returned if they all match to the given search term.
An example on how to use GeoCoder can be found here.
Depending on your use case, maybe consider to use SearchRequest instead. If this does not help it would be great if you can provide more details in your question, e.g. what API flavor you are referring to.
I am new to R and I want to retrieve only the first email received from entire email threads. Each time an email is received in the inbox, a .csv file is created (i.e. I have many files of duplicated text, just differing by newest reply that is on the top of the .csv file)
I am not sure as to how I can provide my codes to help because right now, I don't have any idea how to even start on this segment of my data cleansing.
Is there a way for me to possibly group my .csv files based on the email thread they belong to, before extracting the most duplicated text (since the first email is likely to be present in all subsequent files) to be used in my corpus for topic mining?
Or does anyone have a better way to approach this? I have considered using the threads function in tm.plugin.mail but since these are plain texts, it only returns with a depth of 1 for every email.
EDIT:
The title of the files are just random strings of alphanumerals, and I only have a metadata containing the name of the sender, the date sent (no time provided), and the title of the file that it corresponds to. Here is an idea of what my data looks like:
From: xxx#gmail.com
To: yyy#gmail.com
Subject: Re: xxx
Dear Sir,
(main content)
Yours Sincerely,
xxx
From: yyy#gmail.com
To: xxx#gmail.com
Subject: xxx
Dear Sir,
(main content)
Regards,
yyy
Generally, this is how the .csv file will look like (except that with each comma, there is a new line break as per .csv files), so it is actually quite messy. There is no one fixed way that the email is being formatted, so I had a failed attempt in using regex to remove everything before the last instance of "From:". Some of the emails come in another format:
On (date), (time), (name) <email address> wrote:
I want to make a query to get the information of an actual company and put it in a report. I need to get the full name of company, address, phone number and fax.
I tried to get some information about my company from the table "CompanyInfo" but we don't have a field to get phone or fax. I tried a display method, but the method returned nothing!
I want to make a relation between "CompanyInfo" and "LogisticsElectronicAddress" (I can find phone or fax from LogisticsElectronicAddress.Locator where LogisticsElectronicAddress.Type == phone (or fax)).
Can someone please help me to make a display method or query to get what I want?
Don't make it harder:
Str phone = CompanyInfo::find().phone();
Str address = CompanyInfo::find().postalAddress().Address;
Str zip = CompanyInfo::find().postalAddress().ZipCode;
Will find the current phone number, address and zip code of the current company.
If phone is blank then the phone number is not current. Make sure the phone number is marked "Primary" and that it is valid (in a valid time range as indicated by the ValidFrom and ValidTo fields.
In AX 2012 from "Legal entities", "Contact information", choose "More options" and "Advanced" to see the date rages.
Same thing with the address info.