当前位置:网站首页>Originally, this is the correct posture for developers to open world book day
Originally, this is the correct posture for developers to open world book day
2022-04-22 18:57:00 【Huawei mobile services】
“ Reading music alone is not as good as reading music ”.
What do you mean ? Is to read happily alone , It's better to let more people read happily . This is programmer a Qiang's simple reading view .
As a foreign language book lover , A Qiang wants to enjoy the original flavor of the original foreign language book , But he is always stumbling by strange words that appear from time to time ;
The obstacles of foreign language reading in students' time appear in the stage of literature review , Professional and obscure vocabulary is his greatest efficiency in understanding literature “ killer ”;
Today's global real-time news , No amount of vocabulary can perfectly defend the challenge of new words .
In order to make more people have a better foreign language reading experience , One “ You can't row anywhere ” The reading artifact was born between a Qiang's lines of code , Text translation capabilities using machine learning services , Realize a word delimitation translation function with your bare hands , Make the reading experience of foreign language books smoother .
About text translation
Machine learning services Provide Online and offline text translation capabilities , Support the translation between different languages and have a network scene . for example :
Tourism App in , Provide foreign language road signs 、 Menu and other functions translated into native language , Optimization experience ; Education and learning App, When learning multiple languages , Easily translate unfamiliar language into familiar language , Improve learning efficiency .
meanwhile , Offline translation does not need network support , Communication barriers can be easily solved even in an Internet free environment during the journey .
Effect display

The development of preparation
In the formal development “ Delimitation translation ” The following preparations need to be completed before the function :
To configure AppGallery Connect
Opening service
Integrate HMS Core SDK
Configuration obfuscation script
Add permissions
The specific development preparation can Reference documents
application development
2.1 Reference resources Instructions for using cloud test authentication confidence , Set the authentication information of the application
MLApplication.getInstance().setApiKey("apiKey or Token");
2.2 Create an online text translator
MLLocalTranslateSetting setting = new MLLocalTranslateSetting
.Factory()
.setSourceLangCode(mSourceLangCode)
.setTargetLangCode(mTargetLangCode)
.create();
this.localTranslator = MLTranslatorFactory.getInstance().getLocalTranslator(setting);
2.3 Query the languages supported by online translation
MLTranslateLanguage.getCloudAllLanguages().addOnSuccessListener(new OnSuccessListener<Set<String>>() {
@Override
public void onSuccess(Set<String> result) {
// Successfully obtain the languages supported by online translation .
}
});
2.4 Online text translation
localTranslator.preparedModel(downloadStrategy, modelDownloadListener).addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
final Task<String> task = localTranslator.asyncTranslate(input);
task.addOnSuccessListener(new OnSuccessListener<String>() {
@Override
public void onSuccess(String text) {
displaySuccess(text, true);
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(Exception e) {
displayFailure(e);
}
});
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(Exception e) {
displayFailure(e);
}
});
2.5 Translation complete , Release resources
if (localTranslator != null) {
localTranslator.stop();
}
Learn more about machine learning services >>
visit The official website of Machine Learning Service Alliance
obtain Machine learning service development guidance document
Learn more >>
visit Official website of Huawei developer Alliance
obtain Development guidance document
Huawei mobile service open source warehouse address :GitHub、Gitee
Pay attention to our , The first time to understand HMS Core Latest technical information ~
版权声明
本文为[Huawei mobile services]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204221851530817.html
边栏推荐
- k9. Chapter 2: install kubernetes v1.0 based on binary package 20 -- basic environment configuration and kernel configuration (I)
- What happens when you run the NPM install command?
- RHCE-ansible
- System Analyst - paper writing framework construction
- 漂亮舒服的KN95口罩,防护能力也很强
- MCU infrared module knowledge sharing theory is the basis of practical combat in the future
- Welcome page display
- Mmdeploy quick start
- 描述文件中的全局类型
- 使用RectclerView的一些问题记录
猜你喜欢

C#与 Halcon 联合编程

CVPR2022 | 跨模态检索的协同双流视觉语言预训练模型

Rhce ansible

XML file input of Chapter 13 of kettle paoding jieniu

Nat. Commun. |用于学习生成模型的神经编码框架

What does naas, a charging service provider, rely on to rise without building piles?
![[network security] duomics variable coverage vulnerability from white box test to actual combat](/img/cd/876cad6523e923d5aaada65beb54a2.png)
[network security] duomics variable coverage vulnerability from white box test to actual combat

Alibaba微服务组件Sentinel介绍

MCU infrared module knowledge sharing theory is the basis of practical combat in the future

存储网络请求日志
随机推荐
[untitled] 2022 coal mine outburst prevention test exercise and simulation test
jsp学习(八.JDBC与文件上传处理的项目)
错误 C4996 ‘fopen‘: This function or variable may be unsafe. Consider using fopen_s instead. To disabl
Some problem records using rectclerview
微服务负载均衡器Ribbon介绍
System Analyst - paper writing framework construction
描述文件中的全局类型
C -- database connection statement
Network security -- the use of burp suite packet capture tool
【洛谷】P2372 yyy2015c01挑战算周长(BFS)
Question bank and answers for the retraining of excavator drivers (special types of construction work) in 2022
可以惊艳你的登录网页
剪切的文件在哪里?文件剪切丢失如何恢复?仅需3步
深圳大学课题组发布《深圳市可持续发展评估报告(2016-2021年)》
What are the advantages of enterprise communication software compared with other communication software
【TCP】TCP 三次握手与四次挥手
The 2022 language and intelligent technology competition was upgraded to launch four cutting-edge tasks of NLP
What does %[^\n] mean in C?
[best practice] patrol item: turn on URL authentication in content distribution network (CDN)
RHCE-ansible