Skip to Content
移动端AI与ML应用开发:基于iOS和Android
book

移动端AI与ML应用开发:基于iOS和Android

by Laurence Moroney
January 2023
Intermediate to advanced
288 pages
6h 6m
Chinese
China Machine Press
Content preview from 移动端AI与ML应用开发:基于iOS和Android
Android
上使用
ML Kit
的文本处理应用程序
|
77
5.1.3
编写实体提取代码
使用实体提取 API 时,你需要遵循四个阶段:
1.
通过创建客户端来初始化提取器
2.
通过下载模型来准备提取器
3.
通过注释文本来使用提取器
4.
解析推断的注释
让我们一个一个地查看这些。
首先,你将通过创建客户端来初始化提取器。由于提取器可以跨多种语言工作,它针对
每种语言设计了一个模型,因此在初始化时,你可以通过指定语言来选择正确的模型。
因此,例如,如果你想使用英语,你可以使用如下代码:
val entityExtractor = EntityExtraction.getClient(
EntityExtractorOptions.Builder(EntityExtractorOptions.ENGLISH)
.build())
对于其他语言,你可以使用内置符号将
EntityExtractorOptions
设置为受支持的语言。
在我撰写本书时,有 15 种语言受到支持,你可以查看文档(
https://oreil.ly/aS55g
)以查
看完整集。
请注意,设置语言并不会设置地点。这些是分开保存的,因为使用相同语言的不同地方
可能会做不同的事情。因此,例如,美国和英国的语言都是英语,但它们使用的日期不
同。回顾之前的日期示例,在美国 5/2 5 2 日,而在英国则是 2 5 日。你可以在
下载模型后进行配置。
要下载模型,你要调用
downloadModelIfNeeded()
方法,该方法是异步的,会通过成功 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

人工智能驱动的商业智能

人工智能驱动的商业智能

Tobias Zwingmann
Lua游戏AI开发指南

Lua游戏AI开发指南

Posts & Telecom Press, David Young
人工智能技术与大数据

人工智能技术与大数据

Posts & Telecom Press, Anand Deshpande, Manish Kumar

Publisher Resources

ISBN: 9787111713081