Skip to content

Commit d12a815

Browse files
Google ML KitDong Chen
Google ML Kit
authored and
Dong Chen
committed
Project import generated by Copybara.
PiperOrigin-RevId: 346441329 Change-Id: I91bcecc05d3de4e3999b3fed5a2cf2ba40798be9
1 parent 5504ed4 commit d12a815

File tree

3 files changed

+50
-13
lines changed

3 files changed

+50
-13
lines changed

ios/quickstarts/entityextraction/EntityExtractionExampleObjC/EntityViewController.m

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#import "EntityViewController.h"
1818
#import "MLKEntityExtractionModelIdentifier+Extensions.h"
1919

20-
// TODO(mikie/bauerb): migrate to MLKit umbrella header on public release.
2120
@import MLKitCommon;
2221
@import MLKitEntityExtraction;
2322

ios/quickstarts/entityextraction/EntityExtractionExampleObjC/ModelManagementViewController.m

+7-7
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,15 @@ - (UITableViewCell *)tableView:(UITableView *)tableView
8282
MLKEntityExtractionModelIdentifier language = self.languages[indexPath.row];
8383
NSString *code = MLKEntityExtractionLanguageTagForModelIdentifier(language);
8484
cell.textLabel.text = [NSLocale.currentLocale localizedStringForLanguageCode:code];
85-
#if defined(__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0
86-
if ([self.downloadedLanguages containsObject:language]) {
87-
cell.imageView.image = [UIImage systemImageNamed:@"trash.circle"];
85+
if (@available(iOS 13.0, *)) {
86+
if ([self.downloadedLanguages containsObject:language]) {
87+
cell.imageView.image = [UIImage systemImageNamed:@"trash.circle"];
88+
} else {
89+
cell.imageView.image = [UIImage systemImageNamed:@"icloud.and.arrow.down"];
90+
}
8891
} else {
89-
cell.imageView.image = [UIImage systemImageNamed:@"icloud.and.arrow.down"];
92+
// TODO(mikie): status indicator on iOS < 13
9093
}
91-
#else // __IPHONE_OS_VERSION_MAX_ALLOWED < __IPHONE_13_0
92-
// TODO(mikie): status indicator on iOS < 13
93-
#endif // __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0
9494
return cell;
9595
}
9696

ios/quickstarts/entityextraction/README.md

+43-5
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,57 @@
11
# ML Kit Entity Extraction Quickstart
22

3-
The ML Kit Entity Extraction iOS Quickstart app demonstrates how to use the
4-
Entity Extraction feature of ML Kit to recognize structured data in
5-
text.
3+
* [Read more about ML Kit Entity Extraction API](https://developers.google.com/ml-kit/language/entity-extraction)
64

75
## Introduction
86

9-
TODO(mikie/bhaktipriya): add link to public docs.
7+
The ML Kit Entity Extraction iOS Quickstart app demonstrates how to use the ML
8+
Kit Entity Extraction feature to recognize structured data in text.
9+
10+
This app requires network connectivity in order to download the corresponding
11+
language model.
1012

1113
## Getting Started
1214

13-
- Needs XCode 11.3.1 or above.
15+
- Needs XCode 11.7 or above.
1416
- Run the sample on your iOS device or simulator.
1517
- Type input text and change languages to see entity extraction in action.
1618

19+
## How to use the app
20+
21+
- Enter text in the input box and hit "done" on your keyboard.
22+
- If any entities are found in the text, they will show up on the bottom half
23+
of the screen.
24+
- Click the "Models" button in the bottom right corner to ensure the correct
25+
language model has been downloaded.
26+
27+
### Examples
28+
29+
<table>
30+
<tr><th>Input text</th><th>Detected entities</th></tr>
31+
32+
<tr><td>You can contact the test team <b>tomorrow</b> at <b>[email protected]</b>
33+
to determine the best timeline.</td>
34+
<td>Entity 1 type: Date-Time<br>
35+
Entity 1 text: = "2020-12-09 00:00:00"<br><br>
36+
37+
Entity 2 type: Email address<br>
38+
Entity 2 text: [email protected]</td></tr>
39+
40+
<tr><td>Your order has shipped from Google. To follow the progress of your
41+
delivery please use this tracking number: <b>9612804152073070474837</b></td>
42+
<td>Entity type: Tracking number<br>
43+
Entity text: "FedEx 9612804152073070474837"</td></tr>
44+
45+
<tr><td>Call the restaurant at <b>555-555-1234</b> to pay for dinner. My card
46+
number is <b>4111 1111 1111 1111</b>.</td>
47+
<td>Entity 1 type: Phone number<br>
48+
Entity 1 text: "555-555-1234"<br><br>
49+
50+
Entity 2 type: Payment card<br>
51+
Entity 2 text: "Visa 4111 1111 1111 1111"</td></tr>
52+
53+
</table>
54+
1755
## Support
1856

1957
- [Stack Overflow](https://stackoverflow.com/questions/tagged/google-mlkit)

0 commit comments

Comments
 (0)