viernes, 27 de febrero de 2015

LanguageDetection API Client in Smalltalk

Introduction

Language Detection API is a service to query the language of a given input text. You will need to register an API key in the web site http://detectlanguage.com to use the service. This client enables to use the service from Pharo Smalltalk. The output is an object containing the language code, a confidence score and a 'is reliable' boolean value.

Installation

Inside Pharo, open the Configuration Browser and select LanguageDetection, then Install. Or evaluate the following expression:
Gofer it 
 smalltalkhubUser: 'hernan' project: 'LanguageDetection';
 configurationOf: 'LanguageDetectionAPI';
 loadStable.

Usage

| ldClient |
ldClient := LDApiClient new.
ldClient 
 query: 'Des perles de pluie venues de pays où il ne pleut pas'; 
 detectedLanguageCode.
ldClient 
 query: 'Een enkele taal is nooit genoeg ';
 detectedLanguageCode.
ldClient 
 query: 'buenos dias señor';
 detectedLanguageCode.
Enjoy

1 comentario: