Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
tokyo.northside:java-oxford-dictionaries
Advanced tools
Java client for the Oxford Dictionaries API (herebyafter calls the OD API).
This projects aims to facilitate the interaction with the Oxford Dictionaries API. A complete documentation for the OD API can be reached at: https://developer.oxforddictionaries.com/documentation.
A development status is considered ALPHA
.
A programming interface will be changed.
When you want to use complete implementation of the OD API client on JVM, I recommend Kotlin-oxford-dictionaries library for productions.
The client supports basic two endpoints of the OD API; entries
and translations
.
Api | Supported? |
---|---|
/api/v2/entries/{source_lang}/{word_id}: | ✅ |
/api/v2/lemmas/{source_lang}/{word_id}: | |
/api/v2/translations/{source_lang_translate}/{target_lang_translate}/{word_id}: | ✅ |
/api/v2/thesaurus/{lang}/{word_id}: | |
/api/v2/sentences/{source_lang}/{word_id}: | |
/api/v2/words/{source_lang}: | |
/api/v2/inflections/{source_lang}/{word_id}: | |
Search | |
/api/v2/search/translations/{source_lang_search}/{target_lang_search}: | |
/api/v2/search/{source_lang}: | |
/api/v2/search/thesaurus/{source_lang} | |
Utility | |
/api/v2/domains/{source_lang}: | |
/api/v2/domains/{source_lang_domains}/{target_lang_domains}: | |
/api/v2/fields: | |
/api/v2/fields/{endpoint}: | |
/api/v2/filters: | |
/api/v2/filters/{endpoint}: | |
/api/v2/grammaticalFeatures/{source_lang}: | |
/api/v2/grammaticalFeatures/{source_lang_grammatical}/{target_lang_grammatical}: | |
/api/v2/languages: | |
/api/v2/lexicalCategories/{source_lang}: | |
/api/v2/lexicalCategories/{source_lang_lexical}/{target_lang_lexical}: | |
/api/v2/registers/{source_lang}: | |
/api/v2/registers/{source_lang_registers}/{target_lang_registers}: |
All needed to start using the project is to add the dependency
Maven
<dependency>
<groupId>tokyo.northside</groupId>
<artifactId>java-oxford-dictionaries</artifactId>
<version>0.3.0</version>
</dependency>
Gradle Kotlin DSL
implementation("tokyo.northside:java-oxford-dictionaries:0.3.0")
Gradle
implementation 'tokyo.northside:java-oxford-dictionaries:0.3.0'
Oxford Dictionaries comes with three price tiers: Prototype, Developer and Research. A key can be obtained by following the link https://developer.oxforddictionaries.com/?tag=#plans.
Use the AppId and AppKey when creating the client.
class Main {
public static String getDefinitions() {
String appId = System.getenv("APP_ID");
String appKey = System.getenv("APP_KEY");
String lang = "en-gb";
boolean strictMatch = false;
Collection<String> words = Arrays.asList("ace", "alpha");
//
OxfordThreadClient oxfordThreadClient = new OxfordThreadClient(appId, appkey);
List<OxfordDictionaryEntry> result = oxfordThreadClient.getDefinitions(words, lang, strictMatch);
//
return result.stream()
.map(res -> res.getWord() + ": " + res.getArticle())
.collect(Collectors.joining("<br/>"));
}
}
class Main {
public static String getDefinitions() {
String appId = System.getenv("APP_ID");
String appKey = System.getenv("APP_KEY");
String baseUrl = "https://od-api.oxforddictionaries.com/api/v2";
String lang = "en-gb";
boolean strictMatch = false;
String word = "ace";
//
OxfordClient oxfordClient = new OxfordClient(appId, appKey, baseUrl);
List<Result> results = oxfordClient.queryEntries(word, lang, strictMatch);
//
Result result = results.get(0);
assert(result.getId().equals(word));
//
StringBuilder sb = new StringBuilder();
List<LexicalEntry> lexicalEntries = result.getLExicalEntries();
String title = lexicalEntry.getText();
sb.append("<h3>").append(title).append("</h3>");
for (LexicalEntry lexicalEntry: lexicalEntries) {
sb.append("<ol>");
for (Entry entry : lexicalEntry.getEntries()) {
for (Sense sense : entry.getSenses()) {
if (sense.getDefinitions() == null) {
continue;
}
for (String text : sense.getDefinitions()) {
sb.append("<li>").append(text).append("</li>");
}
}
}
sb.append("</ol>");
}
return sb.toString();
}
}
import java.util.ArrayList;
class Main {
public static List<String> getTranslations() {
String appId = System.getenv("APP_ID");
String appKey = System.getenv("APP_KEY");
String baseUrl = "https://od-api.oxforddictionaries.com/api/v2";
String source = "en-gb";
String target = "fr";
String word = "ace";
//
OxfordClient oxfordClient = new OxfordClient(appId, appKey, baseUrl);
List<Result> results = oxfordClient.queryTranslations(word, source, target);
//
Result result = results.get(0);
assert (result.getId().equals(word));
//
List<LexialEntry> lexicalEntries = result.getLexicalEntries();
List<Entry> entries = lexicalEntries.get(0).getEntries();
List<Sense> senses = entries.get(0).getSenses();
List<Translation> translations = senses.get(0).getTranslations();
//
List<String> out = new ArrayList<>();
for (Translation translation : translations) {
out.add(translation.getText());
}
return out;
}
}
class Main {
public static void main() {
OxfordClient oxfordClient = new OxfordClient(appId, appKey, baseUrl);
RequestFactory f = new RequestFactory(appId, appKey, baseUrl);
f.setQueryWord("ace");
List<Result> results = oxfordClient.query(f.getURL(), f.getHeader());
}
}
FAQs
Unknown package
We found that tokyo.northside:java-oxford-dictionaries demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.