MoneyEntity
Stay organized with collections
Save and categorize content based on your preferences.
A money entity extracted from a piece of text. It provides the values extracted for the
amount (split between the integer and fractional parts) and a canonical format for the
currency.
Inherited Constant Summary
Inherited Method Summary
From class java.lang.Object
Object
|
clone()
|
boolean |
|
void |
finalize()
|
final Class<?>
|
getClass()
|
int |
hashCode()
|
final void |
notify()
|
final void |
notifyAll()
|
String
|
toString()
|
final void |
wait(long arg0, int arg1)
|
final void |
wait(long arg0)
|
final void |
wait()
|
Public Methods
public int getFractionalPart ()
Returns the decimal part of the detected annotation. The amount is split between
whole part and decimal part since different dividers could be used.
public int getIntegerPart ()
Returns the whole part of the detected annotation. The amount is split between whole
part and decimal part since different dividers could be used.
public String getUnnormalizedCurrency ()
Returns the currency part of the detected annotation. No formatting is applied so
this will return a subset of the initial String.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-31 UTC.
[null,null,["Last updated 2024-10-31 UTC."],[[["\u003cp\u003e\u003ccode\u003eMoneyEntity\u003c/code\u003e is a class that extracts monetary values from text, providing the amount (integer and fractional parts) and currency information.\u003c/p\u003e\n"],["\u003cp\u003eIt inherits from the \u003ccode\u003eEntity\u003c/code\u003e class and includes methods to access the fractional and integer parts of the amount, as well as the unnormalized currency.\u003c/p\u003e\n"],["\u003cp\u003eThe currency returned is a substring of the original text and is not formatted.\u003c/p\u003e\n"],["\u003cp\u003eYou can access more detailed information using inherited methods from the \u003ccode\u003eEntity\u003c/code\u003e class for tasks such as type identification and casting to specific entity types.\u003c/p\u003e\n"]]],["`MoneyEntity` extracts monetary values from text, providing the integer and fractional parts of the amount and the currency. It inherits from `Entity`, which defines various entity types like address, date/time, email, etc. `MoneyEntity` offers methods to retrieve the fractional part (`getFractionalPart`), the integer part (`getIntegerPart`), and the unnormalized currency (`getUnnormalizedCurrency`). The class also supports casting to other entity types like `DateTimeEntity` and `IbanEntity`.\n"],null,["# MoneyEntity\n\npublic final class **MoneyEntity** extends [Entity](/android/reference/com/google/mlkit/nl/entityextraction/Entity) \nA money entity extracted from a piece of text. It provides the values extracted for the\namount (split between the integer and fractional parts) and a canonical format for the\ncurrency. \n\n### Inherited Constant Summary\n\nFrom class [com.google.mlkit.nl.entityextraction.Entity](/android/reference/com/google/mlkit/nl/entityextraction/Entity) \n\n|-----|-------------------------------------------------------------------------------------------------------------|------------------------------------------------------------|\n| int | [TYPE_ADDRESS](/android/reference/com/google/mlkit/nl/entityextraction/Entity#TYPE_ADDRESS) | Identifies a physical address. |\n| int | [TYPE_DATE_TIME](/android/reference/com/google/mlkit/nl/entityextraction/Entity#TYPE_DATE_TIME) | Identifies a time reference that includes a specific time. |\n| int | [TYPE_EMAIL](/android/reference/com/google/mlkit/nl/entityextraction/Entity#TYPE_EMAIL) | Identifies an e-mail address. |\n| int | [TYPE_FLIGHT_NUMBER](/android/reference/com/google/mlkit/nl/entityextraction/Entity#TYPE_FLIGHT_NUMBER) | Identifies a flight number in IATA format. |\n| int | [TYPE_IBAN](/android/reference/com/google/mlkit/nl/entityextraction/Entity#TYPE_IBAN) | Identifies an International Bank Account Number (IBAN). |\n| int | [TYPE_ISBN](/android/reference/com/google/mlkit/nl/entityextraction/Entity#TYPE_ISBN) | Identifies an International Standard Book Number (ISBN). |\n| int | [TYPE_MONEY](/android/reference/com/google/mlkit/nl/entityextraction/Entity#TYPE_MONEY) | Identifies an amount of money. |\n| int | [TYPE_PAYMENT_CARD](/android/reference/com/google/mlkit/nl/entityextraction/Entity#TYPE_PAYMENT_CARD) | Identifies a payment card. |\n| int | [TYPE_PHONE](/android/reference/com/google/mlkit/nl/entityextraction/Entity#TYPE_PHONE) | Identifies a phone number. |\n| int | [TYPE_TRACKING_NUMBER](/android/reference/com/google/mlkit/nl/entityextraction/Entity#TYPE_TRACKING_NUMBER) | Identifies a shipment tracking number. |\n| int | [TYPE_URL](/android/reference/com/google/mlkit/nl/entityextraction/Entity#TYPE_URL) | Identifies a URL. |\n\n### Public Method Summary\n\n|-------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| int | [getFractionalPart](/android/reference/com/google/mlkit/nl/entityextraction/MoneyEntity#getFractionalPart())() Returns the decimal part of the detected annotation. |\n| int | [getIntegerPart](/android/reference/com/google/mlkit/nl/entityextraction/MoneyEntity#getIntegerPart())() Returns the whole part of the detected annotation. |\n| [String](//developer.android.com/reference/java/lang/String.html) | [getUnnormalizedCurrency](/android/reference/com/google/mlkit/nl/entityextraction/MoneyEntity#getUnnormalizedCurrency())() Returns the currency part of the detected annotation. |\n\n### Inherited Method Summary\n\nFrom class [com.google.mlkit.nl.entityextraction.Entity](/android/reference/com/google/mlkit/nl/entityextraction/Entity) \n\n|------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [DateTimeEntity](/android/reference/com/google/mlkit/nl/entityextraction/DateTimeEntity) | [asDateTimeEntity](/android/reference/com/google/mlkit/nl/entityextraction/Entity#asDateTimeEntity())() Convenience method that returns the current entity cast to a DateTimeEntity. |\n| [FlightNumberEntity](/android/reference/com/google/mlkit/nl/entityextraction/FlightNumberEntity) | [asFlightNumberEntity](/android/reference/com/google/mlkit/nl/entityextraction/Entity#asFlightNumberEntity())() Convenience method that returns the current entity cast to a FlightNumberEntity. |\n| [IbanEntity](/android/reference/com/google/mlkit/nl/entityextraction/IbanEntity) | [asIbanEntity](/android/reference/com/google/mlkit/nl/entityextraction/Entity#asIbanEntity())() Convenience method that returns the current entity cast to a IbanEntity. |\n| [IsbnEntity](/android/reference/com/google/mlkit/nl/entityextraction/IsbnEntity) | [asIsbnEntity](/android/reference/com/google/mlkit/nl/entityextraction/Entity#asIsbnEntity())() Convenience method that returns the current entity cast to a IsbnEntity. |\n| [MoneyEntity](/android/reference/com/google/mlkit/nl/entityextraction/MoneyEntity) | [asMoneyEntity](/android/reference/com/google/mlkit/nl/entityextraction/Entity#asMoneyEntity())() Convenience method that returns the current entity cast to a MoneyEntity. |\n| [PaymentCardEntity](/android/reference/com/google/mlkit/nl/entityextraction/PaymentCardEntity) | [asPaymentCardEntity](/android/reference/com/google/mlkit/nl/entityextraction/Entity#asPaymentCardEntity())() Convenience method that returns the current entity cast to a PaymentCardEntity. |\n| [TrackingNumberEntity](/android/reference/com/google/mlkit/nl/entityextraction/TrackingNumberEntity) | [asTrackingNumberEntity](/android/reference/com/google/mlkit/nl/entityextraction/Entity#asTrackingNumberEntity())() Convenience method that returns the current entity cast to a TrackingNumberEntity. |\n| int | [getType](/android/reference/com/google/mlkit/nl/entityextraction/Entity#getType())() Returns the type(e.g. |\n| [String](//developer.android.com/reference/java/lang/String.html) | [toString](/android/reference/com/google/mlkit/nl/entityextraction/Entity#toString())() |\n\nFrom class java.lang.Object \n\n|----------------------------------------------------------------------------|--------------------------------------------------------------------------------|\n| [Object](//developer.android.com/reference/java/lang/Object.html) | clone() |\n| boolean | equals([Object](//developer.android.com/reference/java/lang/Object.html) arg0) |\n| void | finalize() |\n| final [Class](//developer.android.com/reference/java/lang/Class.html)\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| [String](//developer.android.com/reference/java/lang/String.html) | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nPublic Methods\n--------------\n\n#### public int **getFractionalPart** ()\n\nReturns the decimal part of the detected annotation. The amount is split between\nwhole part and decimal part since different dividers could be used. \n\n#### public int **getIntegerPart** ()\n\nReturns the whole part of the detected annotation. The amount is split between whole\npart and decimal part since different dividers could be used. \n\n#### public [String](//developer.android.com/reference/java/lang/String.html) **getUnnormalizedCurrency** ()\n\nReturns the currency part of the detected annotation. No formatting is applied so\nthis will return a subset of the initial String."]]