detectlanguage / detectlanguage-java Goto Github PK
View Code? Open in Web Editor NEWDetect Language API Java Client
Home Page: https://detectlanguage.com
License: MIT License
Detect Language API Java Client
Home Page: https://detectlanguage.com
License: MIT License
Hi Team,
When I try to identify language by sentence "Crea una password". DetectLanguage.detect get English.
When I try to with "Crea una" DetectLanguage.detect has 3 options. I guess it works by the last word. When I tried set text as [] array,
the result was the same: English. Expected: Italian. Could you please review it?
There is not much to say. I used the simpledetect method and it returns an exception, but when I do exception.getMessage == null it returns true, so i don't know what is wrong. I am sure is caused by the API.
SSL is on.
(Just because I did not include the API initialization in this snipped, it does not mean that I don't have it)
`
try {
Toast.makeText(getApplicationContext(),DetectLanguage.simpleDetect("Hello"), Toast.LENGTH_SHORT).show();
} catch (Exception e) {
Toast.makeText(getApplicationContext(),e.getMessage(), Toast.LENGTH_SHORT).show();
`
"Try" returns an exception, but when I try to print the exception, it tells me "e.getMessage" is null
java.lang.RuntimeException: java.net.SocketTimeoutException: failed to connect to ws.detectlanguage.com/109.235.67.238 (port 80) after 3000ms
Hey, I'm currently trying to make a minecraft spigot plugin using your API, and I'm running into a wall.
public static String englishOnly(String message){
DetectLanguage.apiKey = "";
String language = DetectLanguage.simpleDetect(message);
if(language.equals("en"))
{
return "en";
}
return "";
}
The "DetectLanguage.simpleDetect(message);" gives the APIError unhandled exception and I'm not entirely sure how to remedy this, I'd greatly appreciate any feedback on the issue.
Thank you for your time,
Regards,
Paddy
After making a query for an entire list, I noticed some returns were completely empty, only returning a '[' in the JSON, which makes it hard to handle and check for sizing.
The examples I tested it with are these:
pwd, bccl, kinlay, lotay, dopshari, gaupay, dargay, helvetas, cdb, pangray, bijay, chojay, sanjay, td, yargay, dcd, gortab, helvatas, jurmay, kaflay, namsay, bg, chungdruk, draftman, gynecologist, mangjay, minjay, nakphay, norbooz, surjay, agrewal, allaway, apecs, bagdogra, bajay, bokray, bumdrag, changchay, chejay, chenray, chotay, dd, dhopshari, dtl, echay, emssd, fd, fsd, gajay, ganglue, gaygay, gaypay, gopay, gunjay, halvetas, hideway, hoilday, hungrap, iffch, jamgay, js, jungnay, karpay, kharl, lakshay, lingshay, lunjay, mafchan, malabasay, mso, nangsay, naphay, ninjay, pelgay, phojay, ramashray, ratney, ropeway, sarswati, sujay, sumjay, swapan, tenshay, thajay, thenpay, thsewang, tlt, tobjay, trk, tshejay, wanjay, yongdrag, aircraf, lubzor
A demo return on 'pwd' is also empty http://ws.detectlanguage.com/0.2/detect?q[]=pwd&key=demo
The JSON response for the first 2 is
{ "data": { "detections": [ [], [] ] } }
Looks like in the Result class should look like this:
public class Result {
public String language;
public boolean isReliable;
public double confidence;
}
to work with GSON
Im getting below error
Exception in thread "main" com.detectlanguage.errors.APIError: Invalid API key
at com.detectlanguage.Client.processResponse(Client.java:72)
at com.detectlanguage.Client.execute(Client.java:54)
at com.detectlanguage.DetectLanguage.detect(DetectLanguage.java:31)
at com.sele.test.com.sele.test.App.main(App.java:57)
code i have used
List<Result> results = DetectLanguage.detect("key");
Result result = results.get(0);
System.out.println("Language: " + result.language);
// System.out.println("Is reliable: " + result.reliable);
System.out.println("Confidence: " + result.confidence);
To test this API, i copied and pasted the "template" from the documentation (except the API key of course) and I got this error
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.