Is there any open databases where I can get how many decimal places are there for that currency? - decimal

My app needs functionality where if User types Euro my app should be able to tell you how many decimal places are thereafter decimal point? for clarification like dollar has 100 cents so there are two decimal places after the decimal point, for example, 32.56 $. My question is where can i get this type of data for most of the currencies in the world?

Yes there is: the official list of currencies from ISO 4217, available as an XML feed.
It's not indexed by currency code but by country, so there is a bit of deduplication to be made. The field you're looking for is CcyMnrUnts:
<CcyNtry>
<CtryNm>FRANCE</CtryNm>
<CcyNm>Euro</CcyNm>
<Ccy>EUR</Ccy>
<CcyNbr>978</CcyNbr>
<CcyMnrUnts>2</CcyMnrUnts>
</CcyNtry>
This is the list we use in the brick/money library.

Related

Dialogflow intent issues or bug

Okay, I am trying to figure out why dialog flow keeps adding dashes or extra numbers when I call my bot and the telephony. I can say 6 digit number and it either adds a dash of an extra number. I have used all the sys entities and a custom entity and it does this every time. It acts as if it wants a phone number. Is there a fix? And yes I have added definitions of how numbers I want back. The number I was asking for is 813637 but it adds numbers and/or dashes. I can add the screenshot to this to show you what I get back
Thanks
As per the Google documentation: https://dialogflow.com/docs/reference/system-entities
The description of #sys.number says the input is represented as Ordinal and Cardinal numbers.
However, as per my understanding you require it to be a Nominal Number. Also in your case i understand it is a sequence of numbers. In which case you should try using #sys.number-sequence.
Hope this works for you.
Do let us know how it goes in the comments.

Phone number and Date of Birth from human speech

Is there an effective Natural Language Processor that can fetch the phone number and date of birth from human speech. Each user has a different way of specifying the phone number and date of birth. Hence, converting speech to text and then parsing the text for phone number is not helpful.
You can use Google speech to text api. I had used same for entering account number for blind people. I was working for bank so I there were lots of numbers involved as input eg account number, card number etc.
With Google STT engine you can define custom voice inputs.
Also I had created feedback mechanism using Text to Speech Api so that app can tell if users feedback is invalid and request him to speak again.
You can see code snippet at github.
https://github.com/hiteshsahu/Android-TTS-STT
Easiest way is to extract text from speech, there is plenty of tools, proprietary (nuance), and tinker friendly open source like sphinx, and plenty of tools to extract dates and phones expressed differently. IBM Watson offers one, Smart Formatting beta, to uniform dates and phones in own transcripts. To guess which dates are birthdays you try detect related keywords (birth, born so on) nearby.
For few free alternatives, check
For phone #
https://www.npmjs.com/package/phone-number-extractor
https://github.com/googlei18n/libphonenumber
For date extractions check prev questions
Extracting dates from text in Java
Best way to identify and extract dates from text Python?
There is a patent for the process your are asking, but you might have to pay royalties or smth.
http://www.freepatentsonline.com/8416928.html
If you want to fetch the phone number and date of birth from human speech.
So, you can use another option and implement it.
https://cloud.google.com/speech/
This API is really useful for converting your speech to text. I also have this problem at one moment so you can try it too.
The another API which is really good for authentication.
https://api.ai/
I hope it helps you.

Excel - Extracting parts of a string with an undefined amount of characters?

Lets say I have 4 columns named "Street number", "Street name", "Suburb" and "State", and three plaintext sentences: "10 magic road sunshine VIC", "105 calder street taylors lakes VIC" and "3 new road airdale QLD".
Right now, I add in special characters between the sections and get it to extract between those, but that's pretty inefficient. Is there anyway to sort though the data and extract the required bits for each column without modifying the data?
No there isn't. You need human brain power to identify if the words belong in the street name or the suburb, and even humans might need help doing that if they are unfamiliar with the locations. There is no logic that can be applied that magically makes that distinction.
What you are describing is generally referred to as "address breakdown" - companies get paid good money for developing algorithms which automate this process, and those algorithms usually require separators between different address parts, and are based heavily on official address products - such as UK Postcode Address File (PAF)
However, a possible alternative - provided you don't have too many addresses, and don't need to do this operation very often - might be to use Google Geocoding Api.
You feed it address and the output is in xml, with qualified address parts: Example
There are many ways you could use that, but I quite like to couple it with google sheets ImportXML function, like so:

How was non-decimal money represented in software?

A lot of the answers to the questions about the accuracy of float and double recommend the use of decimal for monetary amounts. This works because today all currencies are decimal except MGA and MRO, and those have subunits of 1/5 so are still decimal-friendly.
But what about the software used in U.S. stock markets when prices were in 1/16ths of dollar? The accuracy of binary data types wouldn't have been an issue, right?
Going further back, how did pre-1971 British accounting software deal with pounds, shillings, and pence? Did their versions of COBOL have a special PIC clause for it? Were all amounts stored in pence? How was decimalisation handled?
PL/I had a type specifically for British currency - I don't know about COBOL. The British currency at one time incorporated farthings, or a quarter of a penny; I'm not sure though that computers had to deal with those, just with half pennies or ha'pennies.
Accurate accounting usually uses special types - representing decimals exactly. The new IEEE 754 has support for floating-point decimals, and some chips (notably IBM pSeries) have such support in hardware.
COBOL could do it, eg PICTURE 9(4)D88D6 DISPLAY-ST see http://www.computinghistory.org.uk/downloads/10924 page 117
1/16 can be represented in four digits as .0625. For fractions of that type you just add some additional decimal places.

What text format can I use to present data originally in an Excel spreadsheet?

I have an Excel spreadsheet that has many people's estimates of another person's height and weight. In addition, some people have left comments on both estimate cells like "This estimate takes into account such and such".
I want to take the data from the spreadsheet (I've already figured out how to parse it), and represent it in a plain text file such that I can easily parse it back into a structured format (using Perl, ideally).
Originally I thought to use YAML:
Tom:
Height:
Estimate: 5
Comment: Not that confident
Weight:
Estimate: 7
Comment: Very confident
Natalia: ...
But now I'm thinking this is a bit difficult to read, and I was wondering if there were some textual tabular representation that would would be easier to read and still parsable.
Something like:
PERSON HEIGHT Weight
-----------------------------
Tom 5 7
___START_HEIGHT_COMMENT___
We hold these truths to be self-evident, that all men are created equal, that they are endowed by their Creator with certain unalienable Rights, that among these are Life, Liberty and the pursuit of Happiness. That to secure these rights, Governments are instituted among Men, deriving their just powers from the consent of the governed [...]
Wait, what's this project about again?
___END_HEIGHT_COMMENT___
___START_WEIGHT_COMMENT___
We hold these truths to be self-evident, that all men are created equal, that they are endowed by their Creator with certain unalienable Rights, that among these are Life, Liberty and the pursuit of Happiness. That to secure these rights, Governments are instituted among Men, deriving their just powers from the consent of the governed [...]
Wait, what's this project about again?
___END_WEIGHT_COMMENT___
Natalia 2 4
John 3 3
Is there a better way to do this?
CSV (Comma Separated Values).
You can even save it directly into this format from Excel, and read it directly into Excel from this format. Yet it is also human readable, and easily machine parseable.
Normally if I want to capture data from a spreadsheet in textual form I use CSV (which Excel can read and write). It's easy to generate and parse as well as being compatible with many other tools but it doesn't rank high on the "human readable" chart. It can be read but it's awkward for anything but simple files with equal field widths.
XML is an option, but YAML is easier to read. Being human-readable is one of the design goals of YAML. The YAML::Tiny module is a nice and lightweight module for typical cases.
It looks like what you have in mind is a plain text table, or possibly a tabular format with fixed with columns. There are some modules on CPAN that might be useful: Text::Table, Text::SimpleTable, others... These modules can generate a representation that's easy to read but parsing it will be harder. (They're intended for data presentation, not storage and retrieval.) You'd probably have to build your own parser.
Adding to Robert's answer, you can simply put the comments in additional columns (commas will be escaped by the CSV output filter of Excel etc). More on CSV format: www.csvreader.com/csv_format.php
No reason you can't use XML, though I'd imagine it's overkill in this particular case.
There's also Config::General for simple data, and its family of related classes.

Resources